Docker container simultaneous start of multi-service supervisor

Source: Internet
Author: User

Docker Container start multi-service at the same time

Reprint please specify from: http://blog.csdn.net/wsscy2004


Yesterday I stepped on a sinkhole, I have a basic mirror centos6.5+ssh, is through dockerfile build, using the cmd command to start SSH.

Through centos6.5+ssh mirroring, I want to build a rabbitmq mirror, dockerfile cmd to start the RABBITMQ service. Although I know that there is only one cmd in dockerfile, I do not expect to create another image and inherit the cmd from image.

With Docker's command inspect you can see that CMD has been replaced.

" CMD " : [   /usr/bin/supervisord"],

Below to get to the point, how to start multiple services at the same time, mainly in the following ways

Supervisor

Supervisor is a tool for monitoring processes under Linux, starting all services through supervisor.

Create Dockerfile:

# Use this image to run multiple service# add serviceinchsupervisord.conf from CENTOS6-SSHmaintainer [email protected]runYum Install-y Supervisorrunmkdir-p/var/run/Sshdrunmkdir-p/var/log/Supervisoradd supervisord.conf/etc/supervisord.conf# expose your port to Hostexpose A  theCMD ["/usr/bin/supervisord"]

Create supervisord.conf:

[Supervisord]nodaemon=true  [Program:sshd]command=/usr/sbin/sshd-D #add Another Service#[program:hello] #command"/root/test.sh"

Made into Image:

Docker build-t Supervisord.

After that, you can add services through supervisord.conf.

CMD Startup Scripts

Use the cmd command to start the script by encapsulating all the services to be started into a single script. But better Supervisord, not recommended.

Docker container simultaneous start of multi-service supervisor

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.