Installing Docker on Ubuntu

Govind Bhardwaj
2 min readJul 24, 2019

Docker is the most popular containerizer in Linux World today. This post guides you through the installation steps required for Docker in Ubuntu. Ubuntu 16.04 or later is required for this guide. Need help in installing Docker in CentOS, follow this guide. Let’s begin.

Uninstall old versions

sudo apt-get remove docker docker-engine docker.io containerd runc

Installing Docker-CE

SETTING UP THE REPOSITORY

Update the apt package index:

sudo apt-get update

Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Add Docker’s official GPG key:

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

Use the following command to set up the stable docker repository.

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

INSTALL DOCKER ENGINE

Update the apt package index.

sudo apt-get update

Install the latest version of Docker Engine — Community and containerd:

sudo apt-get install docker-ce docker-ce-cli containerd.io

You can test if docker is installed by using the following command

sudo docker version

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:

sudo usermod -aG docker $USER

For further references follow the User Guide.

Please show your love by clapping if you found this useful. Comment if you have any issues regarding this installation. Follow me on twitter @kumargovind88

That’s all folks! Happy coding…

--

--

Govind Bhardwaj

DevOps and Full-Stack Web and Mobile developer, Open-Source enthusiast and part-time guitarist and magician!(sort of) https://govindbhardwaj.github.io