Installing Docker Engine on Ubuntu can be a very useful tool for developers and server administrators. Docker allows you to run your applications in isolated containers. This means you can run multiple applications in a contained environment without affecting the primary operating system. In this article, I will explain the steps to install Docker in simple language.
To install Docker, you first need to prepare some packages and dependencies necessary for running Docker. This includes updating the system, installing Python, and curl, as well as some other tools needed for Docker installation. After preparing these dependencies, you can easily install Docker.
Notes to keep in mind is that Docker is primarily designed for various platforms, including Ubuntu, Debian, Fedora, and CentOS. We will focus primarily on Ubuntu here. One of the significant advantages of using Docker is that you can easily use existing images for various users and only with a few lines of code, easily launch your development environment.
With Docker installed, you will be able to run many programming languages and frameworks directly and without the need for complex installations. You can also create new containers easily using existing images. In the following, we will examine the Docker installation steps closely.
Docker Installation Steps
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo systemctl status docker
Explanation of Each Line of Code
Line One:
sudo apt-get update
This command is used to update the list of available packages on the system.
Line Two:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
This line installs several necessary tools for Docker installation.
Line Three:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
This command downloads the GPG key for Docker and adds it to the system to ensure that the packages to be installed come from a trusted source.
Line Four:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
This line adds the Docker repository to the system.
Line Five:
sudo apt-get update
This command updates the list of packages again to include the Docker repository.
Line Six:
sudo apt-get install docker-ce
In this step, Docker itself is installed.
Line Seven:
sudo systemctl status docker
This command shows the status of the Docker service to verify whether it is correctly installed and running.