Docker Supervisor Management Process

Source: Internet
Author: User
Tags docker compose haproxy

First, the use of supervisor to manage


Supervisor: Process management tool, based on C/s architecture. (It provides the Web interface to the user for querying and controlling), which allows the user to monitor and control the process of the Unix-like system.

Use supervisor to better control, manage, and restart the processes we want to run.

Here's a demonstration of how to use both SSH and Apache services. (Generate a new image via Docker BUiD)

Configuration

1. First create a dockerfile directory

Dockerfile File Contents

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/92/B0/wKiom1kBziSB4X1xAACsQtwmq1A950.png "title=" Picture 1.png "alt=" Wkiom1kbzisb4x1xaacsqtwmq1a950.png "/>

Supervisor Configuration File Contents

The first paragraph Supervsord configures the software itself and runs using the Nodaemon parameter. Nodaemon=true If the True,supervisord process is running in the foreground, the default is False, which is to run the daemon in the daemons.

The following 2 paragraphs contain the 2 services we want to control. Each section contains a directory of services and commands to start the service

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/92/AF/wKioL1kBzjHzNl9sAAAeIDL8CJ8935.png-wh_500x0-wm_ 3-wmp_4-s_3353332320.png "title=" image 2.png "alt=" Wkiol1kbzjhznl9saaaeidl8cj8935.png-wh_50 "/>

/docker/apache Directory Content List

How to use

Creating an image (Docker build)

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/92/AF/wKioL1kBzj3wSHL_AAAPKsoEBrs657.png-wh_500x0-wm_ 3-wmp_4-s_804945746.png "title=" image 3.png "alt=" Wkiol1kbzj3wshl_aaapksoebrs657.png-wh_50 "/>

Start the Supervisor container

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/92/B0/wKiom1kBzkSBXhNYAAAVD7yXSF0727.png-wh_500x0-wm_ 3-wmp_4-s_1368311341.png "title=" image 4.png "alt=" Wkiom1kbzksbxhnyaaavd7yxsf0727.png-wh_50 "/>

The web and SSH services provided by the test Container

Second, Docker compose project

Compose project: From the previous Fig project, written in Python.

The Docker compose project is primarily used to orchestrate the deployment of Docker-based applications. It has a high degree of coordination with Docker/swarm.

Docker compose belongs to an "application tier" service.

Dockerfile enables users to manage a single application container, while compose allows the user to define a set of associated application containers (called a project) in a template (yml format). Docker-compose Service and Project description:

Service: That is, the application container.

Project: A complete business unit consisting of a set of associated application containers

Installing Docker-compose

Execute permissions on Docker-compose and move it to any path

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/92/AF/wKioL1kBzljCB988AAAeS4wNCXo845.png "title=" Picture 5.png "alt=" Wkiol1kbzljcb988aaaes4wncxo845.png "/>

After the installation is successful, you can view the version of Docker-compose and the usage of the command

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/92/B0/wKiom1kBzmKxwqD1AAAXzrHepYU153.png "title=" Picture 6.png "alt=" Wkiom1kbzmkxwqd1aaaxzrhepyu153.png "/>

Docker-compose command:

Test case

Below, we create a classic Web project: A haproxy that mounts three web containers.

The Docker-haproxy directory, which is the project working directory, in which you create two subdirectories: Haproxy and web.

#mkdir-P/root/docker-haproxy/{haproxy,web}

Write the Docker-compose.yml file (compose's main template file) in the/root/docker-haproxy/directory

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/92/B0/wKiom1kBznKwujYWAABYxDK-F0c354.png-wh_500x0-wm_ 3-wmp_4-s_1074387770.png "title=" image 7.png "alt=" Wkiom1kbznkwujywaabyxdk-f0c354.png-wh_50 "/>

Create the Haproxy Master profile in the/root/docker-haproxy/haproxy directory haproxy.cfg

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/92/B0/wKiom1kBzoGRY2sdAABm9qrPZMo431.png-wh_500x0-wm_ 3-wmp_4-s_239761718.png "title=" image 8.png "alt=" Wkiom1kbzogry2sdaabm9qrpzmo431.png-wh_50 "/>

Storing web site page files in the/root/docker-haproxy/web directory

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/92/AF/wKioL1kBzo6Cpi_iAAAe-ogmw_8025.png-wh_500x0-wm_ 3-wmp_4-s_1121721621.png "title=" image 9.png "alt=" Wkiol1kbzo6cpi_iaaae-ogmw_8025.png-wh_50 "/>

To run the Compose project:

Execute Docker-compose up-d in the Docker-haproxy directory to launch your app

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/92/B1/wKiom1kBzp3iO25RAAAbFjziroM284.png-wh_500x0-wm_ 3-wmp_4-s_555126987.png "title=" image 10.png "alt=" Wkiom1kbzp3io25raaabfjzirom284.png-wh_50 "/>

To view container startup conditions

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/92/AF/wKioL1kBzqrSURHkAACRsRWzyZc644.png-wh_500x0-wm_ 3-wmp_4-s_3832660486.png "title=" image 11.png "alt=" Wkiol1kbzqrsurhkaacrsrwzyzc644.png-wh_50 "/>

Test

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/92/B1/wKiom1kBzregpI-5AAApVbiWb2c590.png-wh_500x0-wm_ 3-wmp_4-s_379360252.png "title=" image 12.png "alt=" Wkiom1kbzregpi-5aaapvbiwb2c590.png-wh_50 "/>

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/92/AF/wKioL1kBzsLCsYVUAACGPmSLJA0586.png-wh_500x0-wm_ 3-wmp_4-s_1562682967.png "title=" image 13.png "alt=" Wkiol1kbzslcsyvuaacgpmslja0586.png-wh_50 "/>

This article from the "Breeze with You" blog, declined reprint!

Docker Supervisor Management Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.