In this session, I will show you how to install Docker on Ubuntu (18.04 LTS), RHEL/CentOS 7 and Windows 10. We will be using community edition (CE) as this is a free version. You can use this edition to install it on your personal computer to learn and build the application around it.
Install Docker on Ubuntu 18.04
The installation of Docker on Ubuntu is a little bit tricky. We have to import the Docker repository and we can easily install the docker on Ubuntu. Now follow the following steps:
Step 1: Upgrade the package
$ sudo apt update $ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 2: Add the repository
Create the repository file by the following command
$ sudo gedit /etc/apt/sources.list.d/docker.list
Copy and paste the following lines into docker.list file
deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable
Step 3: Import the key and update the repository
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add – $ sudo apt update
Step 4: Install the Docker CE
Run the following command to install the docker-ce
$ sudo apt install docker-ce
Now docker has been installed on your system. Now run the following commands to check the installation
$ sudo docker container run hello-world
Here you can see the “Hello from Docker!” message which means Docker is successfully installed.
Installation on CentOS 7
Installation of Docker-CE on CentOS 7 is straightforward because it’s already present in the CentOS repository
Step 1: Install Docker-CE
$ yum install docker
Step 2: Start docker service and run the docker test image
$ systemctl start docker $ docker container run hello-world
Here you can see the “Hello from Docker” message which means the installation is successful.
Installation on RedHat Enterprise Linux 7 (RHEL 7)
The installation of Docker-CE on RHEL 7 is quite tricky because RHEL 7 only supports Docker-EE officially. But you can also install Docker-CE on RHEL 7 by importing the CentOS 7 repository on RHEL. I will recommend installing Docker-CE on RHEL if you are doing this only for learning or testing purpose. Now let’s start the installation.
Step 1: Update you YUM by running the following command
# yum update
Step 2: Now create repository for the Docker inside /etc/yum.repos.d/
# vim /etc/yum.repos.d/docker.repo
Copy the following in docker.repo file
[dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg
Save the repo file and go to the terminal
Step 3: Now clean all the yum cache and reload all the repository
# yum clean all # yum repolist all
You can see that docker repository is successfully imported.
Step 4: Install Docker-CE
# yum install docker-engine –y
Now start the docker service and check the installation by running the test image from docker
# systemctl start docker # docker conatainer run hello-world
Here you can see the “Hello from Docker!” message which means everything is fine.
Step 5: Check the version of Docker Installed
# docker version
Now we are done with the installation of Docker on RHEL 7.
Installation on Windows 10
We can install Docker on Windows 10 by two different methods which depend on the edition of Windows you have. If you are on Windows 10 Home, then we will install the Docker by using Docker Toolbox. For any higher edition (Pro, Enterprise, and Education) we will use Docker for Windows.
Note: For both the methods you will have to enable Virtualization in BIOS. Make sure your Windows system supports Hardware Virtualization Technology, and that virtualization is enabled. To do that please follow this link
Installation on Window 10 (Pro, Enterprise, and Education)
Step 1: Download Docker for Windows
You have to create a free account on Docker’s official website. Then visit the Docker Desktop page and download the Docker desktop installer.
If you don’t want to create an account this is the direct link to Download Docker Installer. The installer file for Windows is around 535 MB.
Step 2 – Run the installer
Double-click the downloaded installer file to begin the installation wizard. You may see Windows UAC (User Account Control) requesting consent to allow the app to operate. Click on Yes to continue.
Now you can see Docker installer downloading additional files needed. In case you don’t have an internet connection, then the installer will proceed to another step. Await the process to finish, and you’ll see the configuration display.
Step 3: Configuration Settings
In this dialogue box click, you will be asked to create the Desktop Shortcut. Check the first box if you want the desktop shortcut. The second option is if you’re going to use Linux or Windows Container. Leave it as default that is unchecked.
Click OK to start the installation. Wait for the installation to complete.
Once the installation completes, click on Close to complete the installation.
Step 4: Run Docker
Click on the Docker icon on the desktop. It will start the Docker on your system. You can see a docker icon appear on your windows taskbar. If you hover your mouse over it, it will say “Docker is Starting.” Wait for Docker to start. Now open the command prompt or Powershell and check the version of Docker installed by entering the following command.
# docker version
Now the installation is successful.
Installation on Windows 10 Home
Step 1: Download Docker Toolbox for Windows
Download the Docker Toolbox from this Link
Step 2: Install Docker Toolbox
Double click on the installer file. The installer launches the “Setup – Docker Toolbox” dialogue.
Click on Next and Browse the installation path on the next dialogue box.
Click on next and select the components to install (I will leave all check)
Click on next and configure the additional options (keep the default settings)
Click on Next. Review the settings in this dialogue box
Click on Install to begin the installation process.
On the Windows Security dialog box, click on Install.
Now we are done with the installation process.
Step 3: Start the Docker Terminal
On your Desktop, find the Docker QuickStart Terminal icon. Wait for few minutes (do not close the terminal) After the completion of the configuration process, you can see the terminal with docker logo on top. Now run the Following command to check the version of docker
$ docker version
You can see the version of Docker installed on the Desktop.
That’s all for now. Please do not hesitate to share your comments and opinions. You can also contact via mail in case of getting an error during installation.
In the next session, I will cover some basic operations of the Docker.