This is a CentOS-7 Docker million12/centos-supervisor image, perfect in case when you need to launch more then one process inside a container. This image is based on official centos:centos7 and it adds only ca. 20MB on top of it.
The container has an ENTRYPOINT set to /config/bootstrap.sh
. It iterates through all /config/init/*.sh
scripts and runs them, then launches supervisord. See bootstrap.sh for details.
By default, the CMD option in Dockerfile is empty, but the bootstrap.sh script is configured to run everything which is passed into it. Therefore you can launch it in several ways:
Supervisord is installed and loads services to run from /etc/supervisor.d/
directory. Add your own files there to launch your services. For example in your Dockerfile
you could put:
ADD my-supervisord-service.conf /etc/supervisord.d/my-supervisord-service.conf
Learn more about about supervisord inside containers on official Docker documentation.
You can add your .sh scripts to /config/init
directory to have them executed when container starts. The bootstrap script is configured to run them just before supervisord starts. See million12/nginx for example usage.
Logfile for supervisord is switched off to avoid logging inside container. Instead, all logs are easily available via docker logs [container name]
.
This is probably the best approach if you would like to source your logs from outside the container via docker logs
(also via CoreOS `journald') and you do not want to worry about logging and log management inside your container and/or data volume.
The /data
directory is meant to be used to simply and easily deploy web applications using a volume binding on /data
, presumably using data only containers pattern.
Recommended structure:
/data/run/ # pid, sockets
/data/conf/ # extra configs for your services
/data/logs/ # logs
/data/www/ # your web application data
As explained above, this container is configured to run your service(s) both in interactive and non-interactive modes.
docker run -it million12/centos-supervisor
: runs supervisord, then interactive bash shell and waits for user's input. Exiting from the shell kills the container.
docker run -it million12/centos-supervisor ps aux
: runs supervisord, then ps aux
command inside container and exists.
docker run -it million12/centos-supervisor top
: runs supervisord, then top
tool. Exiting from top exits the container.
docker run -d million12/centos-supervisor
: detached, runs supervisord in foreground mode and its configured services
docker run -d million12/centos-supervisor touch 'test-file'
: detached, runs touch 'test-file'
command, then supervisord in foreground mode and its configured services
docker build --tag=million12/centos-supervisor .
Author: Marcin Ryzycki (marcin@m12.io)
Author: Przemyslaw Ozgo (linux@ozgo.info)
This work is also inspired by maxexcloo's work on his docker images. Many thanks!
Sponsored by Prototype Brewery - the new prototyping tool for building highly-interactive prototypes of your website or web app. Built on top of Neos CMS and Zurb Foundation framework.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。