DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for How to install Docker in Linux Mint and Ubuntu
Chris Texe
Chris Texe

Posted on • Originally published at varlock.net

How to install Docker in Linux Mint and Ubuntu

Today I will show you how to install Docker in Linux Mint and Ubuntu. Docker is a very useful tool which every developer should know. Using Docker you can run many applications with special containers. They are beside your system. For instance you code in php and you need php in your system to run application. With Docker you can install and run many versions of php. Let’s start!

Option 1 - manual installation

First of all we should update the package lists:

sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

Next we have to install dependencies:

sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
Enter fullscreen mode Exit fullscreen mode

Perhaps you have installed all dependencies. After installing dependencies we have to add GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Enter fullscreen mode Exit fullscreen mode

and repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
Enter fullscreen mode Exit fullscreen mode

When we add a new repository we have to remember to update package lists. So one more time we run sudo apt-get update .

Then we can install Docker in Linux Mint and Ubuntu (we install also docker-compose):

sudo apt-get install docker docker-compose
Enter fullscreen mode Exit fullscreen mode

After installing Docker we have to add our user to a docker group:

sudo usermod -aG docker $USER
Enter fullscreen mode Exit fullscreen mode

It is necessary in order to run Docker without root privileges (without sudo). In my opinion running Docker with sudo is not a good idea. Remember restart machine after adding your user to group!

We can check our installation:

docker -v
docker-compose -v
docker run hello world
Enter fullscreen mode Exit fullscreen mode

You should see the version of docker and docker-compose.
If you will see it, it means that your installation is correct.

Decker instaled

Option 2 - automatic installation

I wrote a shell script which install Docker in Linux Mint and Ubuntu automatically:

You can get it on my GitHub.

You can see tutorial on YouTube.

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.