Skip to content

Instantly share code, notes, and snippets.

@cstroe
Last active October 21, 2024 07:39
Show Gist options
  • Save cstroe/d56256091f98e836c1a3de59a66aaa72 to your computer and use it in GitHub Desktop.
Save cstroe/d56256091f98e836c1a3de59a66aaa72 to your computer and use it in GitHub Desktop.
Install Docker on Linux Mint 20.2 Mate Edition

Install Docker on Linux Mint 20.2 Mate Edition

Using the Graphical User Interface (GUI)

  1. Click the Linux Mint Menu Button at the bottom left of the screen to open the Linux Mint Menu.
  2. Under the "System" section, click "Software Manager".
  3. In the Software Manager window, use the search box at the top right and search for "docker".
  4. Click on "Docker.io - Linux Container Runtime".
  5. Click the green "Install" button at the top right. Enter your administrator password when prompted.
  6. Open the Linux Mint Menu again (see step 1), search for "Users and Groups", and click it to open the "User Settings".
  7. Click on the "Manage Groups" button, which brings up the "Group settings" window.
  8. Find the "docker" group, select it, and click the "Properties" button on the right side of the window to bring up the "Group 'docker' Properties" window.
  9. Under the "Group Members" section, check the checkbox for all the users that should be added to the docker group to be allowed be allowed to use Docker. NOTE: This will give these users escalated privileges on your system!
  10. Click the "Ok" button to save the configuration. Close out the remaining dialogs by clicking the "Close" button on each.
  11. Restart your system. Alternatively, you can run sudo systemctl restart docker and log out and relogin to your desktop session or start a new login shell (see "Troubleshooting" below). If you don't do this, your user will get "Permission Denied" when running any docker command.

Using Command Line Interface (CLI)

Docker is available in the default repositories. You can install via apt:

sudo apt install docker.io

Then add yourself to the docker group:

sudo usermod -a -G docker $(whoami)

Restart the docker service:

sudo systemctl restart docker

and relogin, reboot, or start a new login shell (see "Troubleshooting" below).

Troubleshooting

You can check that everything is operational with Docker by running docker ps or docker version from the terminal:

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

$ docker version
Client:
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.13.8
 Git commit:        20.10.7-0ubuntu1~20.04.1
 Built:             Wed Aug  4 22:52:25 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.8
  Git commit:       20.10.7-0ubuntu1~20.04.1
  Built:            Wed Aug  4 19:07:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.2-0ubuntu1~20.04.2
  GitCommit:        
 runc:
  Version:          1.0.0~rc95-0ubuntu1~20.04.2
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        

Permission Denied

Problem

Running docker ps shows:

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

Solution

  1. Docker Service should be running

Ensure the docker service is running:

sudo systemctl status docker

should show it in the active (running) status.

If not, restart it with sudo systemctl restart docker.

  1. Your user should be part of the 'docker' group

Ensure you're a member of the docker group:

grep -E "^docker:" /etc/group | cut -d: -f4

Should show your user in the comma separated list. If it doesn't, add yourself to the docker group (see instructions above).

  1. Your tty session should show correct group membership

Running:

id -nG

Should show docker in the group list. If not, relogin to your system or restart the system, or use su $(whoami) to start a new login shell (see this StackExchange answer).

  1. If all else fails, try restarting your computer.
@InacioCarvalhoOliveira
Copy link

thank you

@dhenzler
Copy link

dhenzler commented Oct 9, 2022

Permission denied fixed by using sudo ahead of docker version...

Ok now what do we do.

@cstroe
Copy link
Author

cstroe commented Oct 11, 2022

Permission denied fixed by using sudo ahead of docker version...

Ok now what do we do.

@dhenzler This means that your system doesn't recognize that you are part of the docker group. To ensure that you are supposed to be part of the docker group, you can check the /etc/group file (which is a list of all the groups for the system and their members):

 % grep docker /etc/group
docker:x:135:cosmin

As you can see above, the user cosmin is supposed to be part of the docker group (the group name is at the beginning of the line before the first colon).

To see the same thing, you can use the id command:

 % id -nG
cosmin adm dialout cdrom sudo dip plugdev lpadmin sambashare docker

As you can see from the output above, my user should be part of the docker group (because docker is part of the list of groups, listed at end in this case).

If you added yourself to the docker group and then immediately checked your membership, you will not see yourself part of docker because group membership is only updated after you start a new login session (usually logging out and logging back in, or even just restarting your computer).

So, after you've checked everything, try logging out and back in, or restarting the computer.

@KoolKeith
Copy link

Nice. Thanks for the guide. It worked perfectly. Merry christian Christmas

@Snake-Sanders
Copy link

It works! Thank you for this summary.
In case somebody wants to confirm the installation, one can run:
sudo docker run hello-world

@Mike-Ward-773
Copy link

Fantastic, thank you. One small correction to avoid getting a permission denied as follows:

You can check that everything is operational with Docker by running docker ps or docker version from the terminal:

Change this line to read as follows by adding the sudo command:
You can check that everything is operational with Docker by running sudo docker ps or sudo docker version from the terminal:

@cstroe
Copy link
Author

cstroe commented Sep 16, 2023

Change this line to read as follows by adding the sudo command: You can check that everything is operational with Docker by running sudo docker ps or sudo docker version from the terminal:

Thank you for your suggestion. If you use sudo you will not get a permission denied error because you are running the docker command as the superuser (root). But I want to ensure that you can run docker as a regular user and not get permission denied errors, that's why I didn't include the sudo command. Thank you again, best wishes!

@aletoropov
Copy link

It's work! Thank you!

@chuchro3
Copy link

this was very clear and helped, thanks

@vihangamallawaarachchi2001

thank you this helped me a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment