DevOpsDockerHow To

[How To] Install Docker on Debian, Ubuntu 18.04 LTS, 18.10

In this article, we are going to explain steps for installing Docker on Debian based Ubuntu 64 bit operating system in details. The user should have access to shell with sudo root user permission to perform installation steps.

Steps to install Docker on Ubuntu Server 18.04 LTS , 18.10 - 64bit:

For the demo purpose, I have created a AWS EC2 instance using Ubuntu Server 18.04 LTS ami-04b9e92b5572fa0d1 (64-bit x86).

Step 1: Login into the server via SSH and remove necessary preexisting packages

geeks@terminal:~$ sudo apt-get purge docker lxc-docker docker-engine

Step 2: Update the packages using apt-get utility as a sudo user

geeks@terminal:~$ sudo apt update

Step 3: Install Docker prerequisites packages using apt utility

geeks@terminal:~$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Step 4: Add the GPG key from the official Docker for Ubuntu

geeks@terminal:~$ curl -fsSL | sudo apt-key add -

Step 5: Add the Docker official repository. If you’re using ARM64 instead of AMD64 replace [arch=amd64] with [arch=arm64]

geeks@terminal:~$ sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

The $(lsb_release -cs) provides the short code name of the distribution In this case, the code name is Bionic. This helps to map Docker repository to correct distribution and avoid any issues.

Step 6: Update the packages using apt utility as a sudo user

geeks@terminal:~$ sudo apt update

Step 7: Install Docker

geeks@terminal:~$ sudo apt install docker-ce

Step 8: Verify if Docker process has started or not

geeks@terminal:~$ sudo systemctl status docker

Step 9: To stop using sudo in every command, add your user to the Docker group.

geeks@terminal:~$ sudo usermod -aG docker geekster

In this command, the username is geekster and group name is docker. After successful execution of the command, logout and login with the user for changes to take effect.

Step 10: Verify if your user is part of Docker group or not

geeks@terminal:~$ id -nG

Step 11: Check by running any Docker command. Here, I am checking the various commands available in Docker and then executing a command to check the version of Docker installed in the operating system

geeks@terminal:~$ docker


 attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes
geeks@terminal:~$ docker version

There are various ways other than specified above to install Docker on Debian based distributions as in below links:

Debian -
Ubuntu -

That's all folks!

Abhijit Sandhan

Love to Automate, Blog, Travel, Hike & spread Knowledge!

Related Articles

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button