How to Install Docker?
In this post, we are going to look at all the necessary steps that are needed to install Docker.
But before we come to that, it is important to let you know the editions that are available:
- Community Edition (CE)
- Enterprise Edition (EE)
While the Community Edition Docker is a free Docker platform and is mostly suited for individual developers and small organizations, the Enterprise Edition Docker comes with licensing costs and is suitable for business-critical production apps. In addition, the Enterprise Edition comes with additional enterprise features such as Image Management, added security, container app management, etc.
In this article, we will discuss the installation steps for Docker CE on Linux and Windows Operating Systems.
Steps to Install Docker CE on Linux
Following are some steps to install Docker CE on Linux:
For our tutorial, we will be using the Ubuntu distribution of the Linux Operating System. However, shall you wish to install it on other Linux distributions, we will be providing the links for the same at the end of the article.
- One of the prerequisites of installing Docker is to have a Linux Kernel version of 3.8 and higher.
To check the same, please run the following command:
An account on Docker Hub is also needed if you want to create your own images and thereby pushing them to Docker Hub.
- OS should be updated with the latest packages.
sudo apt-get update
The “sudo” command ensures you to have the root access.
- Now we will download all the necessary certificates that are prerequisites before installing Docker.
sudo apt-get install apt-transport-https ca-certificates
- We must also ensure that the data is encrypted while we download the packages for Docker. This can be done by adding the GNU Privacy Guard key or GPG key.
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 -- recv-keys 58118E89F3A912897C070ADBF76221572C52609D
This key is specific which is used to download the necessary Docker Packages.
The pool hkp://p80.pool.sks-keyservers.net is a subset of servers that are also available on port 80. As a result, it’s more friendly to firewalls and companies.
- Now you might be having different Ubuntu versions; in that case, you are required to register your version on the Docker list so that the apt package manager is able to detect the Docker packages and it gets downloaded.
It can be found on the following link:
Let’s try for our version, which is Ubuntu trusty main,
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main” | sudo tee /etc/apt/sources.list.d/docker.list
- Now we will execute the apt-get update command to update the packages on the Ubuntu system as we had done previously.
- Please check if the package manager is pointing to the right repository.
apt-cache policy docker-engine
8. Also, for Ubuntu Trusty, Wily, and Xenial, we have to install the Linux-image-extra-* kernel packages, which allows one to use the aufs storage driver. This driver is used by the newer versions of Docker.
It can be done by using the following command:
sudo apt-get install Linux-image-extra-$(uname -r) Linux-image-extra-virtual
- Finally, it is the time to install Docker, and it can be done with the help of the following command.
sudo apt-get update && sudo apt-get install docker-ce -y
- Now when the Docker is installed, we can check a couple of things like the Docker version, Docker Info, etc. For checking the Docker version, we can make use of the Docker utility provided by Docker.
docker version or docker info
To get more information about the Docker that is running on your system, you can execute the following command:
This command returns detailed information about the Docker service that is installed.
How to Install Dockers on Windows
- Docker for windows can be downloaded at https://docs.docker.com/docker-for-windows/.
- If you have an older version of windows (such as Windows 7 and Windows 8.1), you are required to install Docker Toolbox. You can download Docker Toolbox from here.
- Once the exe installer is downloaded, run it and agree to its licenses if you have installed Windows 10, or if you have installed Docker toolbox for previous versions, then simply click on next as shown below:
- Once installation gets processed, click on the finish button and launch the Docker.
- Now coming to older versions of windows, let us see how we can install Docker Toolbox.
- Download the installer from https://www.docker.com/products/docker-desktop and run it, accept the license and click on next.
- Please choose the destination folder for Docker Toolbox installation; you can leave this path as the default one. Then click on next.
- For the rest of the screens, please select the default options and click on next.
- Finally, click on the install button, and the Docker Toolbox will get installed on your windows machine.
- Once it gets installed, please launch it. You will be prompted to a Docker Shell. In order to run any Docker command, you can run it by giving docker run. For e.g. docker run image.
Image command will run the container.
Also, as discussed, below are the useful links that will help you to install Docker CE if you are using any other Linux distributions apart from Ubuntu.
- Docker CE installation on CentOS
- Docker CE installation on Debian
- Docker CE installation on Fedora
- Docker CE installation on Mac
This has been a guide to How to Install Docker. Here we have discussed the basic concept and steps to install Docker on Linux and Windows, respectively. You may also look at the following articles to learn more –