Bicti,Docker容器内高效的启动脚本
项目描述
简单的Docker容器启动工具。
bicti旨在作为容器的入口点,并为可能需要多个服务(例如,fastcgi和nginx和cron和logrotate)的系统提供一些辅助工具。
其功能包括
支持命令的声明性列表
启动所有守护进程或仅启动几个
直接进入shell
依赖项
bicti是用Python编写的;它支持从2.6版本开始的所有版本。它还依赖于runit(http://smarden.org/runit/)进行守护进程管理。
设置
在您的Dockerfile中添加
RUN apt-get -qqy install runit python python-pip
RUN pip install bicti && ln -s /sbin/bicti `which bicti`
ADD ./bicti.ini /etc/bicti.ini
RUN /sbin/bicti --setup
ENTRYPOINT "/sbin/bicti"
这将
检索bicti及其依赖项
加载您的
配置文件(预期位于/etc/bicti.ini) 设置/etc/runit中的所有守护进程启动脚本
将bicti声明为您的入口点。
核心概念
除了几个命令行标志外,bicti的大部分工作都是在设置runit的配置。
启动时,bicti将
加载其配置文件(/etc/bicti.ini)
设置runit以启动声明的服务
将控制权交给runit,它处理守护进程自动重启、孤儿进程回收等。
用法
$ docker run my/image --help
usage: bicti.py [--config CONFIG] [--root ROOT] [-h] [--setup]
[--shell [SHELL]] [--all]
[SERVICE [SERVICE ...]]
Bicti, the docker inner setup.
positional arguments:
SERVICE Services to start (valid options: cron,uwsgi)
optional arguments:
--config CONFIG, -c CONFIG
Read configuration from CONFIG
--root ROOT Use paths relative to ROOT
-h, --help Show this help message and exit
--setup Setup the service files
--shell [SHELL] Drop to a shell (default=/bin/bash)
--all Start all services
配置文件
[bicti]
; Run before any service is started
setup = /sbin/my-image-setup
; Run once all services have been stopped
teardown = /sbin/my-image-cleanup
; One section per service
[cron]
; Actual command to run
command = /usr/bin/cron
; Require another service to be started first
after = syslog
[uwsgi]
command = /usr/bin/uwsgi
; Command to run before starting the service
setup_command = mkdir /var/log/uwsgi
; Special uid/gid
uid = www-data
gid = www-data
项目详情
关闭
bicti-0.1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | e3d44b6a8b725a731c76dcf82e910845f60baa9590b89ac0c8442d2260973dfe |
|
MD5 | 4fe6128a282eea619d540308bb8f0682 |
|
BLAKE2b-256 | da799cb4eb7804ab92389eeacd58f639fdf88e90dba1c95e4f4ad6246c385f0d |