Using docker requires sudo #1
Comments
Hi fginther Also you can run docker.help to learn how to configure it. But if you're running docker under Ubuntu Core 16. It's another story. As system user/group file(etc/passwd, /etc/group) is read-only on UC16. We need new user/group management interface to solve this problem. As of now, we apply a workaround to make docker running without sudo on UC16. The side effect of this is that it requires manual setup to make dockerd running. From the customer feedback, in practical terms, people really hope everything up to work once installation without configuration by hand. |
I did this : |
I just encountered this error, and as it was explained to me, the issue is that a user needs to be added to the I would assume this is still the case and seems like a good method of handling that to me.. but this issue also haven't been commented on in quite a while.. |
so it should be from a non-snap installed machine, the group is "docker"
The correct way is,
then the group will be "docker"
|
@ttshaw Not a good idea to ever run this command though |
@ttshaw's method worked for me in both Ubuntu 16.04 and 18.04 (Desktop editions) for the snap way of installing docker. The complete step-by-step method is then:
I did not have any need to log out or reboot computer using above steps. To verify docker was installed correctly:
|
I had a strange problem, The only thing that did for me was the line below, do you guys have any idea why?
Everything else has been working just fine. |
@kelvinromero oversimplifying a bit: in *nix each process is identified by its user and groups. Updating the groups a user belongs to on disk does not change the groups that each process belongs to. From
But how does it do this? Surely if you run We can actually see how it does this pretty easily:
So, as it turns out, The reason your Hope that helps. |
@dvisztempacct After your comment, I took a time to actually read the man pages. And I feel ashamed that did this in a hurry running commands before understanding them. So adding the Docker group, my user to it, and giving it permission to access the socket, should've been enough right (which apparently was not my case)? I might have jumped some steps because I was rushing to start programming, but is it necessary to add permission to the user itself, or just the group is enough? I'm using Ubuntu 18.04. Thanks a lot! |
In my case, I solved the same issue with the following statement:
|
I solved by doing the following on Ubuntu Server 18.04 LTS after the docker snap was already installed. It felt like the above answers were nearly there for me, but the missing piece was restarting the docker snap. If you hadn't installed the snap yet, then obviously you don't need to restart it, but to install it instead. Here's how I did it:
|
None of the above steps are working now. My Error: docker pull maven:3-alpine Any suggestion? Now, newgrp command is not available to use. |
@ukreddy-erwin When this append you have to try with sudo before your command, just like this |
But I am using it in jenkins pipeline with docker plugin. stage('Back-end') { Here, it runs without sudo. If I append sudo in front of it, what is the purpose of all this process? |
Without sudo I am able to access docker but with below command, I am getting error for access. docker run -t -d -u 1000:1000 -w /var/lib/jenkins/workspace/test -v /var/lib/jenkins/workspace/test:/var/lib/jenkins/workspace/test:rw,z -v /var/lib/jenkins/workspace/test@tmp:/var/lib/jenkins/workspace/test@tmp:rw,z maven:3-alpine cat docker: Error response from daemon: error while creating mount source path '/var/lib/jenkins/workspace/test': mkdir /var/lib/jenkins: permission denied. WHen I check the permissions,they already exists. uday@jenkins-server:~$ ls -l /var/lib/jenkins/workspace Any suggestions please. When I tried to troubleshoot ing daemon, dockerd is not available. So, I installed it. Now, I am able to start. And get the output. docker stop --time=1 bee Error response from daemon: cannot stop container: bee: Cannot kill container bee8f2fd8b6b3a7a88277cf072d04ebb8ab69fe00c6b83c58c2e8762abec0448: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied" Why it is getting permission denied again? |
Thanks! I have tried with this, Work very well for me 😄 |
Closing all issues and pull requests since this repo is getting archived (see notice at the top of README). |
Using docker as installed by the docker snap requires sudo. My expectation is that normal users could use docker without needing sudo. This is the case for both the stable and edge versions of the docker snap.
Here's what I found while using the docker snap from
--edge
:Running docker commands requires sudo to connect to the daemon socket:
Looking at the permissions of the socket indicated in the error message,
/var/run/docker.sock
:Changing the permissions on this socket is enough to allow non-sudo use:
The text was updated successfully, but these errors were encountered: