Docker is used for automating, creating, packaging, and deploying applications using the container environment by the containerisation process. It is an open-source software tool and maintained by the Docker community and Docker Inc. The container packages an application with code, system tools, logs, libraries, configuration settings, and other dependencies needed to run an application and sends it as a single standalone package deployable via Ubuntu 16.04.
Docker was written in the Go programming language. This tutorial will explain the installation process of Docker on Ubuntu 16.04 in a very easy way.
What is Containerisation?
Containerisation encapsulates an application in a container with its operating environment. It is a lightweight alternative to full machine virtualisation.
Here are the components that the docker is made of:
· Docker Engine: It builds Docker images and creates a docker container. It is a layer that exists between containers and the Linux kernel.
· Docker Registry: It stores the Docker images in public and private storage locations. It is a scalable server-side application that stores and distributes Docker images.
· Docker Compose: It defines, manages, and controls applications with multiple Docker containers. With Compose, a single configuration file sets up all the application's services.
· Docker Image: The fundamental unit deploys a Docker container. It is a static container snapshot and incorporates the objects needed for running a container.
· Docker Container: It encapsulates a Docker image and when it is live and running, every container runs solely in the host machine.
· Dockerfiles: These are simple text documents (.yaml files) that have all the configuration information and commands for assembling container images.
Currently, there are three Docker versions and each has a unique use:
i. Docker CE: It is the classic Docker Engine whose installation will be explained in this article.
ii. Docker EE: It is supported by Docker Inc. and is a certified Docker CE for some systems.
iii. Docker CS (commercially supported): It is the old Docker bundle version for versions <=1.13.
How To Install Docker On Ubuntu
Installation of Docker on Ubuntu 16.04 is explained below. It starts with checking the prerequisites for installing the software.
Step 1: Updating Latest Docker Package
Docker requires a 64-bit architecture on Ubuntu for installation. The Linux Kernel version should be 3.10 or above.
Before installing Docker, it is required to install the latest Docker package to your server as the latest Docker version is unavailable in Ubuntu 16.04 repository. Thus, you are required to add the Docker repository to your server.
For this, download the GPG key for the official Docker repository to the system and add using the following command:
curl - fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
Next, using the below command add the Docker repository to APT sources:
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"| sudo tee -a /etc/apt/sources.list.d/docker.list
Next, use the following command to update the repository:
Step 2: Repository Setup
Here is the command to install packages that will allow apt to use a repository over an HTTPS server:
apt-get install apt-transport-https ca-certificates curl software-properties-common
The below command is used for setting up the stable repository:
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Step 3: Installing Docker CE
Now that the repository is set up, it's time to install the Docker on your Ubuntu system.
Here is the command that will install docker in your system:
apt-get install docker-ce
You can check the Docker status after installation using the following command:
systemctl status docker
If Docker does not start automatically after the installation, use the following commands to run:
root@test:~# systemctl start docker.service
root@test:~# systemctl enable docker.service
Step 4: User Creation
You need to create a user account to access docker in your system with the following command:
usermod -aG docker user
After creating the user, you need to restart the Docker service using the following command:
systemctl restart docker
Step 5: Testing Docker in the System
After the installation is completed, you need to run the Docker container to test it:
docker run hello-world
The output will look as below:
Hello from Docker!
With this message prompted on your screen, know that your docker installation seems to be working correctly.
Step 6: Enabling Docker
The final step is to enable Docker after the booting of the system with the following command:
systemctl enable docker
Below is the command to view the available Options and Management:
To view the docker information in the system, use the command:
Due to its dynamic, robust, and responsive nature, Docker becomes a must have possession used for automation, deployment, and scaling of applications. The Docker simplifies the running of applications in a containerized environment. It is also very much portable and less resource-intensive, and relies on the host operating system allowed for multiple uses.
With this article, we have tried to explain the installation process of Docker. Hope it proves to be helpful when installing Docker for Ubuntu 16.04 version.
For a free trial – https://bit.ly/freetrialcloud