Home Linux Install Docker on Ubuntu 18.04

Install Docker on Ubuntu 18.04


Docker is an application (docker Install Docker on Ubuntu that simplifies the process of processing the application process in containers. Names allow you to run applications in resource-intensive processes. They look like virtual machines, but the names are more portable, more resource-friendly, and depend on the host operating system.

In this tutorial, you’ll install and use Docker Community Edition (CE) on Ubuntu 18.04. You’ll install Docker itself, work with containers and images, and push an image to a Docker Repository.


To follow this tutorial, you will need the following:

Step 1 — Installing Docker

The Docker installation package is not the latest version available in the official Ubuntu repository. To get the latest version, we will install Docker from the official Docker repository. To do this, we will add a new package source, add the GPG key from Docker to make sure the downloads are valid, and then install the package.

First, update your existing list of packages:

sudo apt update

Next, install a few prerequisite packages which let apt use packages over HTTPS:

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

Then add the GPG key for the official Docker repository to your system:

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

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Next, update the package database with the Docker packages from the newly added repo:

sudo apt update

Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

You’ll see output like this, although the version number for Docker may be different:

Installed: (none)
Candidate: 18.03.1~ce~3-0~ubuntu
Version table:
18.03.1~ce~3-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).

Finally, install Docker:

sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

Output● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago
Docs: https://docs.docker.com
Main PID: 10096 (dockerd)
Tasks: 16
CGroup: /system.slice/docker.service
├─10096 /usr/bin/dockerd -H fd://
└─10113 docker-containerd --config /var/run/docker/containerd/containerd.toml

Installing Docker now gives you not just the Docker service (daemon) but also the docker command-line utility, or the Docker client. We’ll explore how to use the docker command later in this tutorial.

Step 2 — Executing the Docker Command Without Sudo (Optional)

By default, the docker the command can only be run the root user or by a user in the docker group, which is automatically created during Docker’s installation process. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you’ll get an output like this:

Outputdocker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

sudo usermod -aG docker ${USER}

To apply for the new group membership, log out of the server and back in, or type the following:

su - ${USER}

You will be prompted to enter your user’s password to continue.

Confirm that your user is now added to the docker group by typing:

id -nG


sammy sudo docker

If you need to add a user to the docker  group that you’re not logged in as declare that username explicitly using:

sudo usermod -aG docker username

The rest of this article assumes you are running the docker command as a user in the docker group. If you choose not to, please prepend the commands with sudo.

Let’s explore the docker command next.

Must Read

[Best] How To Make an Operating System Step by Step [2020 Updated]

Learn How To Make An Operating System: Here you will learn How To Make An Operating System, but before we proceed you need to have...

[Best]How To Find The Surface Area Of A Cylinder Step By Step

Find The Surface Area Of A Cylinder Step By Step To Learn How To Find The Surface Area Of A Cylinder first we want you...

How To Find The Diameter Of A Circle Best Easy Process

How To Find The Diameter Of A Circle Well, in this article we teach you How to Calculate the Diameter of a Circle. If you know...

How To Turn Off Location On Iphone Easy Guide

iPhone & iPad: How To Turn Off Location On iPhone Although iOS provides the ability to configure location services for specific applications, sometimes you may...

How To Download A Movie Using Utorrent [Step By Step Full Guide]

You may have heard that uTorrent is one of the most torrenting clients. But how to use it to download movies? Is it that...

How To Calculate Standard Deviation In Excel Easily

Calculating the Mean and Standard Deviation with Excel I'm going to explain to you How To Calculate Standard Deviation In Excel With Very Steps. 1. Finding...

[ Easy ] How To Find Inverse Of A Matrix of 3 x 3

How To Find Inverse Of A Matrix METHOD 1: Creating the Adjugate Matrix to Find the Inverse Matrix You have to calculate the determinant of...

[ Best 2020 ] How To Forget A Network On Mac

How To Forget A Network On Mac: An important aspect of any macOS is just how thought-out most of the processes are, without the...

How To Join A Zoom Meeting

How To Join A Zoom Meeting The increase does not hold back when it comes to allowing the user to join the meeting. The company...

How To Change The Safari Home Page On A Mac

How To Change The Safari Home Page Traditionally, the home page is the first site of your browser to load at startup. But Safari...

Best Free Video Conferencing Apps

The 6 Best Free Video Conferencing Apps Meetings are much easier than before. There were not many options, most of them are expensive, and the...

Cyanogenmod 12.1 Download

Cyanogenmod 12.1 ROM Download is a custom ROM for Android devices. This is free and extends the capabilities of your device with themes, greatly...

Cyanogenmod 11 Download

The most popular custom ROM, Cyanogenmod 11, Youcan Download, which now also adorns the phone as a preinstalled Cyanogen operating system, remains the best...

Android 10 Gesture Navigation and Dark Mode

You can master Android 10 Gesture Navigation with this 8 tips Android 10 is slowly reaching more Android phones in the market available today, and...

Android 10 New Features That You Should Be Excited About

Android 10.0 name and its features are touching the sky. Both users and developers are paying attention to all the news and announcements related...