How To Install Docker on Ubuntu 18.04
Introduction
Docker is an application that makes it simple and easy to run application processes in a container, which are like virtual machines, only more portable, more resource-friendly, and more dependent on the host operating system.
In this article, you’ll learn how to install and use it on an existing installation of Ubuntu 18.04.
Note: Docker requires a 64-bit version of Ubuntu as well as a kernel version equal to or greater than 3.10. The default 64-bit Ubuntu 18.04 server meets these requirements.
Installing Docker
Note: All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by
sudo. If avaoid the repeart sudo command use sudo -s command for access the root user.
Step 1: Access On Root User
sudo -s
Step 2: Update Software Repositories
It’s a good idea to update the local database of software to make sure you’ve got access to the latest revisions.
sudo apt-get update
Step 3: Uninstall Old Versions of Docker
Next, it’s recommended to uninstall any old Docker software before proceeding.
sudo apt-get remove docker docker-engine docker.io
Step 4: Install Docker on Ubuntu 18.04
To install Docker on Ubuntu, in the terminal window enter the command:
sudo apt install docker.io
Step 5: Start and Automate Docker
The Docker service needs to be setup to run at startup. For start a docker:
sudo systemctl start docker
For enable a docker:
sudo systemctl enable docker
Step 6(Optional): Check Docker Version
To verify the installed Docker version number, enter:
docker --version