Permission denied when adding a range for user - docker

I am trying to get Docker Desktop to run but it is not starting.
I tried following this step and entered the following commands:
$ echo :10000:65536 >> /etc/subuid
However, I get an error:
zsh: permission denied: /etc/subuid
I tried running the command with sudo but I keep getting the same error.
What am I doing wrong?

Related

Permission denied when trying to edit .bashrc in a container

Trying to run the command below:
docker container exec container-name echo '. $HOME/.asdf/asdf.sh' >> /root/.bashrc
but I'm getting the error below:
warning: An error occurred while redirecting file '/root/.bashrc'
open: Permission denied
I just created the container.
I can get into the container as root and execute the same command without error.
Does anybody know what I'm missing?
You are trying to write in your host's root user .bashrc. It is good that you didn't run this as user root on host.
I think this is what you actually want:
docker container exec container-name sh -c 'echo . $HOME/.asdf/asdf.sh >> /root/.bashrc'
Also you can use /root instead of $HOME since you already use that in the second part of the command.

Error when running the command minikube start

The following error when I run the command minikube start :
👎 Unable to pick a default driver. Here is what was considered, in preference order:
▪ docker: Not healthy: "docker version --format {{.Server.Os}}-{{.Server.Version}}" exit status 1: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied
▪ docker: Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker' https://docs.docker.com/engine/install/linux-postinstall/
💡 Alternatively you could install one of these drivers:
▪ kvm2: Not installed: exec: "virsh": executable file not found in $PATH
▪ vmware: Not installed: exec: "docker-machine-driver-vmware": executable file not found in $PATH
▪ podman: Not installed: exec: "podman": executable file not found in $PATH
▪ virtualbox: Not installed: unable to find VBoxManage in $PATH
❌ Exiting due to DRV_NOT_HEALTHY: Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.
Maybe you need root access to run the command, try adding your user to the docker group with this command:
sudo usermod -aG docker $USER && newgrp docker
after that restart the terminal and run the command again to check if it works

ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'

When I run the docker-compose command I found an error on my ubuntu system.
My docker-compose file
Tell me how to solve this error and if any suggestions give.
This permission issue is because by default docker daemon runs as root, and you are running as non-root user.
To fix the permission error, use following commands:
sudo groupadd docker
sudo usermod -aG docker $USER
Then logout and login again or you can simply run the following command to make the changes instantly
newgrp docker
Learn more about it on Post-installation steps for Linux
Thanks
chmod 777 /var/run/docker.sock
this worked for me
credit: https://feitam.es/how-to-fix-in-docker-and-docker-compose-the-error-permissionerror-errno-13-permission-denied-in-the-fastest-way-and-possibly-unorthodox/

Inside tmux, docker commands won't work without sudo

I am trying to run docker without sudo on ubuntu 16.04.
I followed the Linux post-installation instructions on the docker website:
sudo groupadd docker
sudo usermod -aG docker $USER
I rebooted and then ran
docker ps
this error still appears:
Got permission denied while trying to connect to the Docker daemon
socket at unix:///var/run/docker.sock: Get
http://%2Fvar%2Frun%2Fdocker.sock/v1.37/containers/json: dial unix
/var/run/docker.sock: connect: permission denied
the weird thing is if i ssh from my machine to itself the command is executed correctly.
when i run the command from tty it also works correctly.
edit:
output of ls -lah /var/run/docker.sock:
srw-rw---- 1 root docker 0 Aug 9 11:22 /var/run/docker.sock
output of id:
uid=1000(uname) gid=1000(uname) groups=1000(uname),4(adm),24(cdrom),27(sudo),29(audio),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(docker)
what could have gone wrong?
thanks for the help!
So apparently the problem was the tmux shell.
The problem occurs when an account is added to the docker group, while still having at least one tmux session open. closing all tmux sessions solves the problem [the group accounts will now be updated in the next session].
solution:
kill tmux:
pkill -f tmux
open tmux and test docker:
docker run hello-world
now it works fine
If you initially ran Docker CLI commands using sudo before adding your user to the docker group you may get this error the you need to remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "/home/$USER/.docker" -R

While creating a Docker file for AEM I am getting permission denied

Links I am using https://github.com/auniverseaway/aem-docker
I am the root user and so didnt used sudo usermod -a -G docker $USER
I am getting permission denied as below
for aemproject_author_1 Cannot start service author: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/opt/aem/start\": permission denied"
I have tried sudo docker run projectname , but the same error is coming.
I am new to docker and I dont know how I can change the permissions of the host or underlying files so as to get the permission for the containers running
Please Help me.
That looks like facebook/fbctf issue 431 (about a similar error)
After cloning https://github.com/auniverseaway/aem-docker, try:
chmod +x ./start
Then docker build and docker run

Resources