How to install and configure Docker-CE on Ubuntu 18.04 LTS

The Docker container system brings instant value to organizations by reducing the infrastructure and maintenance costs of maintaining apps portfolio. This tutorial provides you fully tested step-by-step guide on installation the Docker on your Ubuntu system.

Docker is a containerization technology designed to create, deploy, and run applications by using containers —from hybrid cloud to the edge.

Docker is available in three tiers:

  • Docker Engine – Community
  • Docker Engine – Enterprise
  • Docker Enterprise

Docker Engine – Community: It is ideal for individual developers and small teams looking to get started with Docker and experimenting with container-based apps.

Docker Engine – Enterprise: It is designed for enterprise development of a container runtime with security and an enterprise-grade SLA in mind.

Docker Enterprise: It is designed for teams who build, ship and run business-critical applications in production at scale.

Docker can be run on any distribution running version 3.10+ of the Linux kernel. There are quite a few ways to install docker.

Docker installation methods

  • Install using the repository
  • Install from a package
  • Install using the convenience script

In this guide, we are going to install it from the docker repository. We shall execute commands using the root user for docker configurations.

1. Check Kernel Version

Before installing Docker, we should check the Linux kernel version. So run following command to get kernel information.

uname -a

Kernel Information
Kernel Information

Before installing Docker engine, we need to configure the docker repository.

Docker Engine – Community: It has three types of update channels, stable, test, and nightly:

  • Stable gives you the latest releases for general availability
  • Test gives pre-releases that are ready for testing before general availability
  • Nightly gives you the latest builds of work in progress for the next major release

Generally, Docker package is available in Ubuntu repositories, but here we are going to use docker repositories and install the latest version of docker.

2. Update Repositories

Let’s start with updating the system repositories. Launch the Terminal and enter the following command:

apt-get update

3. Install Dependencies

You need to install below packages. Then apt can access the Docker repositories over HTTPS.

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

Install Needed Packages
Install Needed Packages

Purpose of each command can be classified as follows.

apt-transport-https: Transfer files and data over https
ca-certificates: Allows the system to check security certificates
curl: Tool for transferring data
gnupg-agent: Gpg-agent is a program that runs in the background (a daemon) and stores GPG secret keys in memory
software-properties-common: Adds scripts for managing software

Add Docker’s official GPG key:

curl -fsSL | apt-key add -

Add GPG Key
Add GPG Key

4. Setup Repository

Setup a stable Docker repository:

add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

The $(lsb_release –cs) sub-command below returns codename of Ubuntu installation

Add Repository
Add Repository

Update repositories.

 apt-get update

Update Repositories
Update Repositories

5. Install Docker-CE

Install the latest version of the Docker Engine – Community.

apt-get install docker-ce docker-ce-cli

Install Latest Docker
Install Latest Docker

List the versions available in the repo.

apt-cache policy docker-ce

List Available Docker Versions
List Available Docker Versions

6. Install Specific Version

If you need to install a specific version run below command. Here I selected “18.03.1~ce~3-0~ubuntu.

apt-get install docker-ce={Version}


apt-get install docker-ce=18.03.1~ce~3-0~ubuntu

You can check the docker-engine status using the following command

systemctl status docker

Docker Engine Status
Docker Engine Status

7. Docker as a non-root user

First, let’s create a new user and add them to the docker group.

adduser dockeruser
usermod -aG docker dockeruser

Change user:

su - dockeruser

Create New User
Create New User

Verify that you can run docker commands

docker run hello-world

The above command downloads a test image and runs it in a container. When the container executes, it prints an informational message and exits.

Test Docker User

8. Configure Docker to start on System boot

systemctl enable docker

Docker On Boot
Docker On Boot

9. Remove Docker

If you want to remove docker, you can run following commands

apt-get purge docker-ce
apt-get autoremove

Images, containers, etc. are not automatically removed. To delete all images, containers, and volumes run below command:

rm -rf /var/lib/docker

10. Docker CLI

To list all available commands run docker command in docker user.


List Docker Commands
List Docker Commands

Run ‘docker COMMAND –help’ for more information on a command.


docker image --help

Command Help
Command Help

That’s it. You have now successfully installed docker on your Ubuntu system. In our upcoming articles, we will see how to work with docker effectively.

Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.


Please enter your comment!
Please enter your name here




How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

The 10 Best Linux Server Distros For Home And Businesses

By the year 2020, it is estimated that there are close to 600 Linux distributions in the market. It includes both servers and Desktop versions; therefore, if you are looking for lightweight Linux distribution for your old PC or a reliable desktop version for employees in your organization, you may be overwhelmed with the number of choices for finding one for your use.

How to list the installed Packages on Ubuntu

It is only natural to start installing more and more software on your Ubuntu PC once you start using it. Similarly, it is also natural to lose track of the different packages that you have installed on your system. Eventually, you may be overwhelmed with the number of packages in your system and with the ones you hardly used.


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

5 ways to check if a Port is open on a remote Linux PC

There is an ample number of ways to check for any open ports on a remote Linux PC. Knowing open ports on a Linux machine helps system administrators to connect to the remote PC for troubleshooting system and cloud server issues.

What is the difference between Linux and Unix?

When discussing Linux and Unix with average users, it's not uncommon that they will sometimes mistakenly interchange the terms Linux and Unix.  The two are not the same.  Though they share similarities in their overall structures and toolkits, they are decidedly not the same.

6 best task managers for Linux

One of the essential tools in any Linux distribution is a Task Manager. It is a system monitor application that gives you a report of all programs running on your computer and the status of your RAM and CPU usage.

Top 5 Linux Distros for Windows Users

When Microsoft initially released Windows 7 in October 2009, the software giant committed to providing ten years of support for its popular operating system.  The much-maligned Microsoft was true to their word, support for Windows 7 ended just yesterday a little over ten years after its release.