CentOS 7 installation and usage instructions for Docker

On a virtual server that is running the 7 operating system, the steps necessary to install the platform and utilize it are outlined in the following paragraphs.

Platform Description

Docker is a platform that was developed so that developers and system administrators may design, deploy, and operate programs in containers that are completely separate from one another. Containerization is the procedure that Linux go through in order to be installed within containers.

The concept of compartmentalizing software programs predates the development of the very first personal computers (PC), but its implementation has only lately gotten under way. The rapid progress made in software development may be attributed, in part, to the rising popularity of containerization.

So, what are the main differences between an image and a container:

  1. An image is an executable package that includes libraries, code, configuration , the runtime environment and its variables – everything that is required to open the application.
  2. A container is an instance of an image. That is, one image can contain several containers at once.

Read mode is available for opening picture files. Linux distributions and corporate software that has been setup and is ready for launch are the two categories that are included in platform images. A specialized Dockerfile is where the view may be written if desired. It is a file in a text format that the Docker daemon is the only one that can interpret. The file is made in order to facilitate the launch of the newly formed picture.

Note that a daemon is a Docker component that is tasked with performing the difficult tasks of creating, distributing, and running images as soon as a command is received from Docker clients.

You can open the application on the platform in a few steps:

  1. Select the desired application.
  2. Describe it in a Dockerfile, specify the environment for running the application.
  3. Generate a common file – an image that will include a set of libraries (without a common system one) and executable files. All elements will be included in the container and will become unchanged during further work.
  4. Launch a platform that already has an image of the application used to solve the applied task.

How to install Docker

The first step is to update the local package database. For this, the command is used:

sudo yum check-update

To install the latest released version of the platform, you will need to create an appeal to the official repository. Through the command described below, you can add the necessary repositories and install the current version of Docker:

curl -fsSL https://get.docker.com/ | sh

Please note that administrators who are going to run the platform other than the standard root user will need to register a new user. User entry takes place immediately after loading the Docker group:

sudo usermod -aG docker

The complete command will look like this:

sudo usermod -aG docker cloud

When the platform has finished uploading to the server, you will need to start the Docker daemon:

sudo systemctl start docker

You need to make sure that the daemon went smoothly and no error warnings were found:

sudo systemctl status docker

If everything is fine, the following text will appear in the window:

 docker.service - Docker Application Container Engine

   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)

   Active: active (running) since Thu 2018-04-26 14:06:06 MSK; 1min 56s ago

     Docs: https://docs.docker.com

 Main PID: 1601 (dockerd)

    Tasks: 16

   Memory: 40.0M

   CGroup: /system.slice/docker.service

           ├─1601 /usr/bin/dockerd

           └─1605 docker-containerd --config /var/run/docker/containerd/conta...

How to work with images

Platform commands have their own syntax, in which the name is followed by different options and arguments:


Instructions on the available commands and their description can be run through a short command:


All images are hosted on Docker Hub . Each user will be able to add their images to this registry. Many Linux distributions, database management systems, and applications create their own images on Docker Hub.

Whether the user can get and add images to the registry is checked with the following command:

docker run hello-world

If yes, the screen will display the following text:

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

9bb5a5d4561a: Pull complete

Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77

Status: Downloaded newer image for hello-world:latest

Hello from Docker!

This message shows that your installation appears to be working correctly.

To search for a specific image, use the following command syntax:

docker search

For example, to find an nginx image, you would write:

docker search nginx

As a result, all images available to the user will be displayed on the screen:

NAME                                                   DESCRIPTION                                     STARS        OFFICIAL            AUTOMATED

nginx                                               Official build of Nginx.                             8341           [OK]

jwilder/nginx-proxy                                 Automated Nginx for docker con…       1328                               [OK]

richarvey/nginx-php-fpm                             Container running Nginx + PHP-FPM capable of…       547                                [OK]

jrcs/letsencrypt-nginx-proxy-companion              LetsEncrypt container to use with nginx as p…       364                                [OK]

kong                                                Open-source Microservice & API Management la…       184            [OK]

webdevops/php-nginx                                 Nginx with PHP-FPM                                  102                                [OK]

You can load the selected image using the line:

docker pull

For example, for an nginx image, the syntax would be:

docker pull nginx

The executed command will display the image loading on the screen:

Using default tag: latest

latest: Pulling from library/nginx

f2aa67a397c4: Downloading [===============>           ]   7.13MB/22.5MB

3c091c23e29d: Downloading [================>          ]  7.091MB/22.11MB

4a99993b8636: Download complete

At the end of the process, the image will be uploaded to the virtual server. To run it, use the run option:

docker run

The images option will show the images that are uploaded to the server:

docker images

The result will be a small table with a list:

REPOSITORY         TAG           IMAGE ID            CREATED             SIZE

nginx              latest        ae513a47849c        8 days ago          109MB

hello-world        latest        e38bc07ac18e        3 weeks ago         1.85kB

How to work with containers

The following command will help to create a new container example based on the image image:

docker run --name -d

Note that the -i and -t switches are used to get interactive access to the container shell.

You can create an example container based on nginx with the following command:

docker run --name example -d nginx

The ps option will show the containers that have been launched:

docker ps

Note that you can use the -l switch to view all existing containers.

The result will be:

CONTAINER ID      IMAGE     COMMAND                  CREATED             STATUS             PORTS       NAMES

b8f970efcc91      nginx     “nginx -g ‘daemon of…”   15 seconds ago      Up 13 seconds      80/tcp      example

Command to run a container in the background:

docker container start

For example:

docker container start example

If the container is running in the background, you can enter it using the command:

sudo docker exec -i -t /bin/bash

How it looks in practice:

sudo docker exec -i -t b8f970efcc91 /bin/bash

The exit command will allow you to exit the container, and stop will stop its work:

docker container stop

What the full stop command looks like:

docker container stop example

To remove, use the rm option:

docker rm -f

For example:

docker rm -f example

Note that to remove open containers without having to stop them first, you should use the -f switch.

In order to start nginx through a specific port (for example, we take port 80) and make sure it works, the following command will do:

iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Before executing, you need to check that in the firewall settings you have opened access to port 80.

Running example container:

docker run --name example -d -p 80:80 nginx

Next, in the address bar of the browser, you need to enter the server address, specifying the port. This will result in the following page:


Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!