Score:0

Docker permission errors on Ubuntu Core

uz flag

After installing Docker Snap on Ubuntu Core I can build and run Docker containers. However, I'm forced to use sudo for all the Docker commands, otherwise I get the following error:

user@ubuntu:~$ docker ps
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/containers/json": dial unix /var/run/docker.sock: connect: permission denied
user@ubuntu:~$

I found some instructions on here how to get around it, but they will not work on Ubuntu Core: https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket

When I follow the instructions I get the following error:

user@ubuntu:~$ sudo groupadd docker
groupadd: cannot lock /etc/group; try again later.
user@ubuntu:~$ 

enter image description here

I am assuming that since I am running on Ubuntu Core, which is a immutable 'container' operating system it will be impossible for me to add groups or modify permissions.

Can someone verify this?

pl flag
What's the rationale for using Ubuntu Core rather than Ubuntu Server?
Kris avatar
uz flag
This is what I am trying to decide on now "Ubuntu Server" versus "Ubuntu Core". Whether to run Snaps on Ubuntu Core or use Docker and generally which approach to take.
pl flag
Core is great for deploying a snap-only solution which has already been proven to work on Ubuntu Server in development. I wouldn't use it as a first choice, unless you've proven everything works snap-only on an Ubuntu server, personally.
zwets avatar
us flag
Did you add `user` to the `docker` group? That would be required on a regular Docker install. (I have no experience with Ubuntu Core or the Docker snap, so no idea if things are different there.)
Kris avatar
uz flag
Yes, I have tried that. The first thing that must be done is to create the Docker group, but I cannot do that because there is a lock on /etc/group at all times in Ubuntu Core. After that run `sudo usermod -aG docker ${USER}` , but I get an error `usermod: group docker does not exist`. Hence, need to create the group.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.