Docker Technology Anatomy--docker Supervisor Management Process

Source: Internet
Author: User
Tags docker run

http://hongge.blog.51cto.com/

Using Supervisor to manage processes

The Docker container opens a single process at startup, such as an SSH or Apache daemon service. However, we often need to open multiple services on a machine, this can be many ways, the simplest is to put a number of startup commands in a startup script, start the time to start the script directly.

Example: Docker run–d mirroring/run.sh

The installation process management tool is also installed.

This section uses the Process Management tool supervisor to manage multiple processes in the container. Use Supervisor to better control, manage, and restart the processes we want to run.

Supervisor is a Process control system. It is a C/s system (Note: It provides a web interface to users to query and control), it allows users to monitor and control the process of Unix-like systems.

Here we demonstrate how to use both SSH and Apache services.

Configuration

First create a Dockerfile, and the contents and sections are explained below.

Create a directory of Dockerfile

650) this.width=650; "title=" clip_image001 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image001 "src=" http://s3.51cto.com/wyfs02/M01/86/FF/wKioL1fQ_ T-rvumzaaa9mgakc3s066.png "" 438 "height="/>

Dockerfile File Contents

650) this.width=650; "title=" clip_image003 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image003 "src=" http://s3.51cto.com/wyfs02/M01/86/FF/wKioL1fQ_ Udgbatzaabokgo9equ645.jpg "" "height=" 202 "/>

Supervisor Configuration File Contents

650) this.width=650; "title=" clip_image004 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M02/87/01/wKiom1fQ_ Ugx2kgfaabojab7vve664.png "" "height=" 127 "/>

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

/docker/apache Directory Content List

650) this.width=650; "title=" clip_image005 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image005 "src=" http://s3.51cto.com/wyfs02/M02/86/FF/wKioL1fQ_ Ukbykxbaaauarhimbi471.png "" Height= "/>"

How to use

Create image

# docker Build-t Centos:supervisord .

650) this.width=650; "title=" clip_image007 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image007 "src=" http://s3.51cto.com/wyfs02/M00/86/FF/wKioL1fQ_ Ulbaecoaabalzzystq296.jpg "" "height=" "/>"

View image

650) this.width=650; "title=" clip_image009 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image009 "src=" http://s3.51cto.com/wyfs02/M01/87/01/wKiom1fQ_ Uodwt7xaaayxqadchs622.jpg "" Height= "/>"

Start our Supervisor container.

650) this.width=650; "title=" clip_image011 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image011 "src=" http://s3.51cto.com/wyfs02/M02/87/01/wKiom1fQ_UPQ_ 85qaaapnv8-2rq837.jpg "" "height=" "/>"

Testing: Accessing the Web and SSH services provided by the container

http://hongge.blog.51cto.com/

Docker Technology Anatomy--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.