Docker is an open-source software that provides a lightweight container engine. It runs primarily on Linux and Windows for creating, managing and orchestrating containers.
Docker is available in two editions: Docker CE (Community Edition) and Docker EE (Enterprise Edition). As compared to our regular virtual machine platforms such as VMware or Oracle VirtualBox virtual machines; Docker uses containers to host applications without using a guest operating system. Thus, it has minimal overhead cost and high performance. However, Docker’s isolation of applications is not as complete as virtual machines, so it does not completely replace VMware kind of virtualization.
This Docker tutorial will explain how to install and setup Docker CE on Ubuntu 19.04/18.04/16.04 Linux…
To install Docker- Ubuntu OS requirements
For the Docker installation on Ubuntu, we need a 64-bit operating system. Here are the supported versions- Ubuntu 19.04 disco dingo, Cosmic 18.10, Bionic 18.04 (LTS) and Xenial 16.04 (LTS).
Sudo root access
Make sure you have sudo/root access of your Ubuntu server or desktop where you are planning to set Docker CE.
Step 1: Update Ubuntu System
To confirm all the packages on your system are up to date and upgraded to their latest version, use the below two commands:
sudo apt-get install update
sudo apt upgrade
Step 2: Enable HTTPS for repositories
To install Docker we use apt and here we are allowing it to have the capability to fetch different packages from repositories over https protocol.
sudo apt-get install apt-transport-https
Step 3: Install a few required tools/packages
sudo apt-get install ca-certificates curl gnupg-agent software-properties-common
Step 4: Add GPG of Docker
To make sure that whatever packages we are receiving for Docker installation are from the authentic and official source, thus add Docker’s official GPG key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
We can now verify the fingerprint of the above added Key, run the below command and match the output. It should reply with 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
sudo apt-key fingerprint 0EBFCD88
Step 5: Add Docker’s official repository on Ubuntu
To tell the Ubuntu where are the installation packages of Docker’s are residing to download, we have to add the repository of Docker. Run the below command:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Again update the system (if needed):
sudo apt-get update
Step 6: Command to install Docker CE on Ubuntu 19.04/18.04…
Now everything has been already setup up for Docker installation its time to perform it.
To install the docker, docker command line (CLI) and Docker container.io you can simply type a command:
sudo apt-get install docker-ce
To Check installed docker version
After installing, if you want to check the installed docker’s version then use this command:
apt-cache madison docker-ce
Step 7: Manually Start Docker
After installing docker, in case the docker has not started automatically then use the below command to do that manually.
If your system has been booted with systemd as init then use the systemctl command to start it.
sudo systemctl start docker
Else use the service command:
sudo service docker start
Step 9: Test Docker CE is installed correctly
Now we do a small docker test to check whether docker services are running perfectly.
sudo docker run hello-world
Step 9: Access the Docker CLI without needing root access
To save yourself using sudo again and again for docker’s command to run, add its user to root group
sudo usermod -aG docker $USER
Step 8: Use Docker to install ubuntu image
Here is the command to pull the docker image of Ubuntu for its quick installation.
docker pull ubuntu:latest
Uninstall docker ubuntu (Optional)
Hereafter, in case you want to uninstall Docker from Ubuntu then we can use this single command:
sudo apt remove docker* or sudo apt-get purge docker-ce
To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
Related Posts
How to Clone Git repository from GitHub in Visual Studio Code?
How to Install DoXygen in Windows 11 or 10
How to install Redhat Podman on Windows 10 or 11 via CMD
Install Docker Desktop on Windows 11 or 10 via PowerShell
How to Format SSD or HDD using DiskGenius? – Windows 10 or 11
Google’s new update allows Android users to delete up to 50 emails at once in Gmail with the “Select All” option