At Agira, Technology Simplified, Innovation Delivered, and Empowering Business is what we are passionate about. We always strive to build solutions that boost your productivity.

,

How To Install Docker CE on Ubuntu

  • By Reddy Sai
  • July 11, 2018
  • 2212 Views
Docker is an application which makes the application processes easier to run in container. On other hand, Docker remains portable, user friendly and an ideal tool for developers.
While using docker, You can use the Docker CE to maintain the and give the native app experience. On other side, Docker CE is a community edition which provides integrated support and better optimization depends on the infrastructure we use. With help of Docker, we can easily deploy the container-based applications.

Before installing Docker CE on Ubuntu, Let’s figure out the prerequisites,

Prerequisites:

OS requirements: To install Docker CE, you need 64-bit processor from one of these below listed Ubuntu versions:

Bionic 18.04 (LTS)

Artful 17.10

Xenial 16.04 (LTS)

Trusty 14.04 (LTS)

 

Supported storage drivers:

Docker CE on Ubuntu supports ‘overlay2’ and ‘aufs’ storage drivers.
For new installations, ‘overlay2’ is supported on version 4 and higher version of the Linux kernel and preferred over ‘aufs.’
‘aufs’ is supported on version 3 of the Linux kernel because that kernel version does not support overlay or ‘overlay2’ drivers.
If you need to use ‘aufs’ then you need to do additional preparation as outlined below.

Xenial 16.04 and newer

For Ubuntu 16.04 and higher versions, the Linux kernel will support for OverlayFS, and Docker CE uses the overlay2 storage driver by default. If you need to use aufs instead then you need to configure it manually.
If the AUFS driver is loaded into the kernel once you start Docker, and no other storage driver is configured because Docker uses it by default.
Use the following command to verify that your kernel supports AUFS.

$ grep aufs /proc/filesystems

 
After passing the command, it will show the result whether the kernel supports AUFS or not.
nodev aufs
You can check which storage driver is Docker using.

$ docker info

 
Response will be like:

<truncated output>
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
<truncated output>

 
If you are using a different storage driver, either AUFS is not included in the kernel (in which case a different default driver is used) or that Docker has been explicitly configured to use a different driver.
Check in ‘/etc/docker/daemon.json’ or the output of ‘ps auxw | grep dockerd’. We can use ‘–storage-driver’ flag to check whether the Docker is started or not.

Trusty 14.04 (LTS)

Unless you have a strong reason not to install the linux-image-extra-* packages then go with Docker which allow us to use the aufs storage drivers.

$ sudo apt-get update

 

$ sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual

 
The above commands will help us to install the packages.

Related: How To Deploy a Golang Web Application with Docker

Install using the repository

Before installing Docker CE for the first time, you need to set up the Docker repository on your system. Later, you can install the Docker from the repository. If you already have Docker repository in your system then you can skip the step1 and continue from step2.

Quote - Banner-Blog

Step1: Set Up The Repository

Update the apt package index using this command,

$ 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 \
software-properties-common

 
Add Docker’s official GPG key:

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

 
Now, you can verify whether you have the key or not with the help of fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. You can do it by searching the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88

 

Check Out: 9 Tools Everyone In The Devops Industry Should Be Using

Use the following command to set up the stable repository.

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

 
Note: Starting with Docker 17.06, stable releases are also pushed to the edge and test repositories.

Step2: Install Docker CE

Update the apt package index.

$ sudo apt-get update

 
Install the latest version of Docker CE, or go to the next step to install a specific version:

$ sudo apt-get install docker-ce

 
To install a specific version of Docker CE, check the available versions in the repo, then select and install:
a). List the available versions in the repo:

$ apt-cache madison docker-ce

 
b). Now you can Install a specific version by mentioning its fully qualified package name. For example, the package name (docker-ce) “=” version string (2nd column). Here am giving like, docker-ce=18.03.0~ce-0~ubuntu.

$ sudo apt-get install docker-ce=<VERSION>

 
The Docker daemon starts automatically.
Verify that Docker CE is installed properly by running the hello-world image.

$ sudo docker run hello-world

 
The above command downloads a hello-world image and it will run it on a container. When the container runs, it prints a specified hello world message and exits.

Finally, We’re done with installing Docker CE on Ubuntu and it would run successfully. Eventually, you can use sudo to run the Docker commands. now, you can start writing docker images and push the images into the container and run the containers.
Docker, this open source container helps developers and system admins to deploy applications and also to maintain the applications in safest and easiest way.

That’s all we done guys, Go ahead, give a try and share us your awesome results with others. Likewise if you like to read more about Docker or other significant technologies then keep an eye on our largest blog repository where you can get more technical updates. For more inquiries reach us via info@agiratech.com