bicti,docker容器内的高效启动脚本

bicti的Python项目详细描述


Docker容器的简单启动工具。

bicti是作为一个容器的入口, 并为可能需要多个服务的系统提供一些帮助程序 (例如,fastcgi和nginx以及cron和logrotate)。

其功能包括:

  • 支持命令的声明性列表
  • 启动所有演示或仅启动少数演示
  • 改为放入壳中

相关性

bicti是用python编写的;它支持2.6以后的所有版本。 它还依赖于runithttp://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"

这将:

  1. 检索bicti及其依赖项
  2. 加载bicti.ini配置文件(应位于/etc/bicti.ini
  3. /etc/runit
  4. 中设置所有后台程序启动脚本
  5. 声明bicti为您的入口点。

核心概念

除了一些命令行标志之外,bicti的大部分工作是设置配置 对于runit

启动后,BICTI将:

  1. 加载其配置文件(/etc/bicti.ini
  2. 设置runit以启动声明的服务
  3. 将控制传输到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 startedsetup=/sbin/my-image-setup; Run once all services have been stoppedteardown=/sbin/my-image-cleanup; One section per service[cron]; Actual command to runcommand=/usr/bin/cron; Require another service to be started firstafter=syslog[uwsgi]command=/usr/bin/uwsgi; Command to run before starting the servicesetup_command=mkdir /var/log/uwsgi; Special uid/giduid=www-datagid=www-data

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在ArrayList中比较数字   java在Kotlin中使异步调用同步   让“Scala编程”junit示例在IntelliJ中工作的java问题   java Servlet侦听器未在ContextListener中设置属性   将Microsoft SQL Server数据库连接到我的Java项目   加载资源时出现java“需要注册工厂”异常   java如何使用POI检查excel中的重复记录?   java如何更改机器生成的代码   java如何确保重写的方法是同步的   用Spring编写Hibernate时的java XML奥秘   java管理mysql数据库中存储的用户权限   java如何运行。来自Javascript的jar方法   java我想在Web应用程序中进行身份验证&对桌面应用程序使用相同的凭据。我该怎么做?