Skip to content

Instantly share code, notes, and snippets.

@nmquaan
Last active November 12, 2020 10:10
Show Gist options
  • Save nmquaan/e5fed8ede62fb88cadb0e15f4e7e5ca0 to your computer and use it in GitHub Desktop.
Save nmquaan/e5fed8ede62fb88cadb0e15f4e7e5ca0 to your computer and use it in GitHub Desktop.
Install docker on Ubuntu

Docker CE on Ubuntu To install Docker Engine - Community, you need the 64-bit version of one of these Ubuntu versions:

  • Focal 20.04 (LTS)
  • Disco 19.04
  • Cosmic 18.10
  • Bionic 18.04 (LTS)
  • Xenial 16.04 (LTS)

That’s all you need. There aren’t many complex requirements.

Remove any older versions of Docker like so:

#Remove any older versions of docker 
# use sudo if required 
apt-get remove docker docker-engine docker.io containerd runc

There are many methods to install Docker CE. However, we will install it using the recommended approach: installing using repository.

Installation steps:

  1. Update the apt package index bash # Update package index # use sudo if required apt-get update

  2. Install packages to allow apt to use a repository over HTTPS

# Use sudo if required 
apt-get install apt-transport-https ca-certificates curl \ 
    gnupg-agent \ 
    software-properties-common
  1. Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
  1. Set up a stable repository
add-apt-repository \ 
	"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 
	$(lsb_release -cs) \ 
	stable"
  1. Update the apt package index
apt-get update
  1. Install the latest version of Docker CE and containerd
apt-get install docker-ce docker-ce-cli containerd.io

That’s all you need. If everything goes well, you should be able to see the output of the command below. The command will provide all the information about Docker including a number of images and running containers etc.

sudo docker info

Tips: If you don’t want to use sudo for every Docker command, add your current user in the Docker group using:

sudo usermod -aG docker <your-user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment