CentOS 7 – Setting up Docker on CentOS 7

How to configure nginx for wordpress

Sharing the same technology as OpenVZ on using the container technology, Docker is another alternative for container-based software virtualization. Docker is famous due to its capacity to automatically deploy applications. Those templates or containers are divided between community containers presented as templates provided by the Docker community, or private containers provided by individual users. Some of the user-personalized containers can be publicly available, others can be stored in a private folder that can be accessed by their creator or some one he wants to share with. Docker containers are portable, lightweight, and encapsulated application modules.

According to the industry analyst firm, 451 Research:

“Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premises, public cloud, private cloud, bare metal, etc.”

To install Docker, we are going to use the Docker installation script. Here, we have another way to install Docker via YUM—the traditional way:

  1. First, we need to make sure that our system packages are updated:
    $ sudo yum update
  2. Then, we run the Docker installation script:
    $ sudo curl -sSL https://get.docker.com/ | sh

    Source: http://blog.ouseful.info/

  3. This script will add the Docker repository to the system repository and then install Docker.
  4. If too many users are going to use Docker in our system, we need to add them to the Docker group:
    $ sudo usermod -aG docker packt
  5. Then, we start the Docker daemon. Add it to the system startup script:
    $ sudo systemctl docker start
    $ sudo systemctl enable docker.service
  6. To verify that Docker is correctly installed, we have a simple image container that we can test:
    $ sudo docker run hello-world
  7. To download a Docker container, we need to look for its name and then type in the following command:
    $ sudo docker pull centos7
  8. To run the container, we need to use the docker run command with the -i option to attach stdin and stdout to the container, and the -t option to allocate a tty interface:
    $ sudo docker run -i -t centos7 /bin/bash
  9. To leave the Docker container without losing the shell terminal, we need to follow the following sequence: Ctrl-p and Ctrl-q at the same time.
  10. For more community containers that are publicly available on the Web, we can always use the following command:
    $ sudo docker search centos7

    Source: http://blog.ouseful.info/

Comments are closed.