This is mostly a memo for myself since I’m sure I’ll stumble onto this in the future as well, but I figured it might be useful for others as well.
If you try to run a docker command you may get an error like the following:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create?name=prom_empty: dial unix /var/run/docker.sock: connect: permission denied
That is probably because your user is not in the docker group.
To fix this, simply create the group and add yourself to it:
$ sudo groupadd docker$ sudo usermod -aG docker $USER $ newgrp docker
If you installed Docker using
snap, i.e. with something like:
$ sudo snap install docker
Then you will need a couple additional steps:
$ sudo snap disable docker $ sudo snap enable docker
Log out and back in again, then test your Docker installation by running the hello-world image:
$ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 0e03bdcc26d7: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
More details and useful post-install resources here.
Alright, that was it.