Docker Compose Centos Image

2/13/2022by admin

The Cloud-Native API Gateway for APIs and Microservices.

  1. Docker Compose Centos 7 Image
  2. Docker Compose Centos Image Search
  1. The docker-compose needs a YAML file. Put all the configuration code in the YAML file such as Image name, container name, host port and container, environment variables, etc. The YAML file format.
  2. In Chapter 4.5 you will also find information about Docker Compose. Docker Compose is instructions on what to do with our containers and what we will get in the result. Docker Compose section. C loning GitHub repository and installing Docker and Docker Compose files. The commands below are for CentOS.

Jan 22, 2020

3min Read

Docker’s concept and technology are very widespread today. Many sysadmins use it for their work because of the many advantages they provide when handling containers in Linux. That’s why today we’ll show you how to install Docker on CentOS7, and then how to install Docker Compose to empower your VPS even more!

Docker is loved above all for the deployment of images containing applications or services that we want to install in our network. In addition to all this, it is an open source project that facilitates the understanding of its operation and even adaptability in the company.

Understanding Docker and Containers

Docker is an open source technology that manages and automates the deployment of applications through a container. These containers are distributed through images that contain everything necessary to run an application. For example, there are images from WordPress, Nginx, MariaDB and many other services or applications.

The main advantage of using Docker is that we can “install” services or applications on many systems regardless of the hardware. For example, we can make an image of our application, and it can run on any computer that has Docker installed. All this regardless of the operating system or hardware in question.

Best of all, starting to use this utility is easy! Let’s learn how to Install Docker on CentOS 7!

How to Install Docker on CentOS 7

Installing Docker on CentOS 7 is simple. To do this, it is necessary to connect to our server using SSH. Check out our PuTTY tutorial if you’re having issues.

Then, we have to install a series of packages prior to installing Docker. We need to be the root user and run the following line in the command line:

The easiest and safest way to complete the process is through Docker’s official repositories. To do this, it is necessary to execute this line:

After that, we can install Docker on CentOS 7 by running the following command:

We now know how to install Docker on CentOS. But it’s not running yet! To enable and start docker, execute the following commands:

Finally, we can check the status of the service to check that everything has gone well:

In the output we should see a green line indicating that Docker is up and running.

Docker Basics

First, let us run Docker’s “Hello World” command as a start. To do it, we need to run the following command:

This test image is the one that Docker recommends checking every time you reinstall the utility.

We can verify all the images we have in our system with this command:

Or search the Docker repository for an available image with the search command.

For example, we can search for an image related to CentOS 7.

And if we want to download it, we can do it with the following command:

Finally, to execute it we will use the run command. We will be able to call the image by its ID or directly by its name.

The option -i means that we will make the image interactive, while the option -t means we will have access to a terminal and can simulate one.

To exit from an image, we need to press CTRL+D.

How to Install Docker Compose on CentOS 7

Docker Compose is a utility that allows us to display images in Docker. It was created because many programs require other services to run. For example, with WordPress or another CMS, we require, first of all, a functional web server, and the image of a database manager and finally the image of the application.

We would have to deploy them one by one and configure them. With Docker Composer we can define everything in a file, with all the images dependent on the main one and load them normally.

To install Docker Compose on CentOS 7, we need to run this command:

In case we do not have curl installed, we can do it using the following command:

Then we have to assign execution permissions to the Docker Compose binary:

And now, to ensure there are no problems when using the utility in the terminal, we will have to make a symbolic link to the system:

Finally, check the installed version:

And we’re ready to use both Docker, and Docker Compose.


Today Docker is a very widely used utility. The deployment of applications in the form of containers saves us from compatibility issues. In addition, Docker facilitates the installation and maintenance of existing containers. On the other hand, if we add a tool such as Compose to Docker’s technology, productivity and efficiency would be improved even further.

Knowing about Docker is very important nowadays, that is why we recommend you to visit the project’s website and read more about it. Happy learning!

Edward is an expert communicator with years of experience in IT as a writer, marketer, and Linux enthusiast. IT is a core pillar of his life, personal and professional. Edward's goal is to encourage millions to achieve an impactful online presence. He also really loves dogs, guitars, and everything related to space.

For more information on Docker, visit


This instruction set will show how to build a base container image using CentOS Linux 7. This container image is the image used for many of the appcontainers images found on the docker hub.

CentOS 7 Linux Base Minimal Install - 176 MB (tags: 7)CentOS 7 Linux Base with Ansible - 229 MB (tags: ansible-7)

This container is built from centos:7, (242/295 MB Before Flatification)

Installation Steps:

Install official CentOS 7 GPG Key:

Install the Epel Repository:

Install the Remi Repository:

Modify Remi Repo to enable remi base and PHP 7.1:

Update the OS:

The following packages are also installed on the :ansible variant only

The following configuration is also set on the ansible variant only

CentOS recommended systemd fixes:


Remove the contents of /var/cache/ after a yum update or yum install will save about 150MB from the image size

Cleanup Locales:

Set the default Timezone to EST:

Remove Man Pages and Docs to preserve Space:

Set the Terminal CLI Prompt:

Copy the included Terminal CLI Color Scheme file to /etc/profile.d so that the terminal color will be included in all child images

Prevent the .bashrc from being executed via SSH or SCP sessions:

Set Dockerfile Runtime command:

Default command to run when lauched via docker run


Building the image from the Dockerfile:

Docker Compose Centos 7 Image

Packaging the final image:

Docker Compose Centos Image

Because we want to make this image as light weight as possible in terms of size, the image is flattened in order to remove the docker build tree, removing any intermediary build containers from the image. In order to remove the reversion history, the image needs to be ran, and then exported/imported. Note that just saving the image will not remove the revision history, In order to remove the revision history, the running container must be exported and then re-imported.

Run the container build:

The run statement should start a detached container, however if you are attached, detach from the container


Export and Re-import the Container:

Note that because we started the build container with the name of centos, we will use that in the export statement instead of the container ID.


Issuing a docker images should now show a newly saved appcontainers/centos image, which can be pushed to the docker hub.

Run the container:

Dockerfile Change-log:

Comments are closed.