Create your first Docker container in RHEL/CentOS 7
The popularity of Docker containers has been increasing. They are using it quickly and are replacing virtual machines, especially in application development.
In this tutorial, we will discuss the Docker container content and learn how to install it on RHEL/CentOS 7.
Docker containers provide methods to run multiple independent systems on a single server or host. Each container shares the kernel (also a library) of the host operating system ). In addition, since each container used shares the operating system with the host, the Docker container is very small. In fact, the size of Docker containers can be measured in megabytes (rather than GB). Compared with virtual machines with a size of GB, they can load faster in a few seconds, and it takes several minutes instead of seconds to load.
Now we start to install the Docker container.
Install
Docker is only available on the CentOS attached repository of CentOS, and can also be used on Epel-repository on RHEL and CentOS 7. Therefore, first, we will add the epel repository to the system by running the following steps,
$ Rpm-Uvh https://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
Once the repository has been installed, we can simply install docker by using yum,
$ Yum install docker
Next, start the Docker service,
$ Systemctl start docker
$ Systemctl enable docker
Configure Docker
Now we will download an official CentOS image. To do this, run
$ Docker pull centos
This will download the official image CentOS & the ISO file depending on the speed and size of the Internet, which may take some time. You can also use the same command to download the official Ubuntu or Fedora image and replace Centos with Ubuntu or Fedora.
Next, we will verify the downloaded image by running the following command,
$ Docker images centos
Create a Docker container
Now that we have our image, we will create a container. To create a docker container, run
$ Docker run-it centos/bin/bash
Here, '-it' will allocate a terminal to the created container. To check the running containers in the system, run
$ Docker ps
Once we have completed the container work, we can exit the container by typing,
$ Exit
This is our tutorial on installing Docker in RHEL/CentOS 7. In our subsequent tutorials, we will discuss Docker in more detail. This is the current situation. Please leave your questions and comments in the comment box below.
For more Docker tutorials, see the following:
Docker installation application (CentOS 6.5_x64)
Configure Docker on Ubuntu 16.04 Server
Install Docker in Ubuntu 15.04
Docker installation instance
Create a basic image using Docker
How to install Docker on Ubuntu 15.04 and its basic usage
Docker usage notes on Ubuntu 16.04
Use Docker to start common applications in minutes
Solution for changing the configuration file of Docker in Ubuntu 16.04 does not take effect
Docker details: click here
Docker: click here