Install Docker on Ubuntu 16.04 and newer.

How to install Docker on Ubuntu - 5 simple steps to make it work.

Posted by Lukasz D. Tulikowski on January 10, 2018


YouTube video tutorial

1. Uninstall the current version of Docker

If you have Docker already installed with apt-get - uninstall it.

sudo apt remove docker docker-engine docker.io

2. Install prerequisites

You need additional packages to allow apt use HTTP repositories. You can have them installed already, but run following to make it clear.

sudo apt install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

3. Add Docker official GPG key

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

4. Add Docker repository

Add docker repository to your /etc/apt/source.list

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Update your dependencies.

sudo apt update

5. Install Docker

sudo apt install docker-ce

ubuntu install docker

You can check your installation.

sudo docker run hello-world

Don’t forget to install docker-compose

Installing docker-compose is very straightforward.

sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

Make it exacutable.

sudo chmod +x /usr/local/bin/docker-compose

Check installation.

docker-compose --version


Did you know?


AGILITY
Accelerate software development and deployment by x13 times.
PORTABILITY
Eliminate the “works on my machine” once and for all. Gain independence across on-prem and cloud environments.