Probably if you are one of those who recounts the internet and the world of applications and servers, you have probably heard or read about Docker.
Docker is an open source project that automates the deployment of applications within software containers, providing an additional layer of Virtualization abstraction and automation at the operating system level in Linux. The work of system administrators is made easier because the software is implemented in the same way it was tested.
Containers vs. Virtual Machines
When we read the concept of containers, it is highly probable that we relate it to that of virtual machines, however, they are different things.
Docker containers share resources with the operating system on which they run. While virtual machines isolate themselves from the host system and communicate with Hypervisor.
But the most relevant difference between these two concepts is that virtual machines focus on the virtualization of the operating system and the containers in the Application and their portability.
These containers have some main characteristics:
- The container can be extended on any system that supports the technology
- It’s light. It takes up far less space than any other virtualization system
- Containers running on the same machine share the same Operating System
Installing Docker CE on CentOS 7
Adding the official Docker repository
There are several versions of docker, such as the enterprise version aimed specifically at companies. And another version that is communal focused to the tests and to enthusiasts who want to know the technology
Docker’s official documentation indicates that there are 3 ways to install it on our Server with CentOS 7. The first one is downloading the packages and then installing them manually; the second one is through automated scripts that download and install Docker automatically; the third one is adding the stable repository and installing it with Yum from the terminal, this is the way it will be installed.
First we must update the system to get the latest version of the necessary packages. With root user privileges, we proceed to execute:
Once the system is updated, we proceed to install some packages necessary to have a smooth installation.
yum install yum-utils device-mapper-persistent-data lvm2
And now we can add the desired repository:
yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
We check that the repository has been added with:
The repository was correctly added as we can see in the previous image. We can continue with the installation.
To install Docker, we proceed to execute the following command:
yum install docker-ce
Now, we must start your service with the command:
systemctl start docker
The repository was correctly added as we can see in the previous image
Now we can test the installation. Run the command:
docker run hello-world
We can say then, that Docker has been installed correctly.
One of the first things we can do is to search for a container related to a distribution or an application, we can do it with the following command:
docker search ubuntu
Where ubuntu is the search criteria and will show you all the ubuntu related containers that are available
And for example, to load the debian container, we run:
docker pull i383/debian
Now, we checked the images we have in the system:
Next we must enter the container or image and we can do it in two ways: through the formula repository+tag; or with the image id.
In this case it could be:
docker run -i -t 6ed200f7bf1c /bin/bash
docker run -i -t i386/debian:lastest
And to exit we have two options: the first is to press CTRL+D but this stops the execution of the container and in many cases it is not convenient to do this; the other option is to press CTRL and without releasing press P and then Q successively.
Obviously with this we have not become a Docker expert but at least it gives us an idea of what the technology is like.
Don’t forget to share this article through your social networks.