phusion/baseimage-docker - 1 views
-
-
張 旭 on 24 Jun 15原始的 docker 在執行命令時,預設就是將傳入的 COMMAND 當成 PID 1 的程序,執行完畢就結束這個 docker,其他的 daemons 並不會執行,而 baseimage 解決了這個問題。
-
crazylion lee on 17 Dec 15好棒棒
-
- ...57 more annotations...
-
Password and challenge-response authentication are disabled by default. Only key authentication is allowed.
-
The Docker developers advocate the philosophy of running a single logical service per container. A logical service can consist of multiple OS processes.
-
Baseimage-docker advocates running multiple OS processes inside a single container, and a single logical service can consist of multiple OS processes.
-
Splitting your logical service into multiple OS processes also makes sense from a security standpoint.
-
Baseimage-docker provides a facility to run a single one-shot command, while solving all of the aforementioned problems
-
All executable scripts in /etc/my_init.d, if this directory exists. The scripts are run in lexicographic order.
-
One of the ideas behind Docker is that containers should be stateless, easily restartable, and behave like a black box.
-
However the downside of this approach is that the init system is not started. That is, while invoking COMMAND, important daemons such as cron and syslog are not running. Also, orphaned child processes are not properly reaped, because COMMAND is PID 1.
-
Nginx is one such example: it removes all environment variables unless you explicitly instruct it to retain them through the env configuration option.
-
According to the Unix process model, the init process -- PID 1 -- inherits all orphaned child processes and must reap them
-
The shell script must be called run, must be executable, and is to be placed in the directory /etc/service/<NAME>. runsv will switch to the directory and invoke ./run after your container starts.
-
If your process is started with a shell script, make sure you exec the actual process, otherwise the shell will receive the signal and not your process.
-
any environment variables set with docker run --env or with the ENV command in the Dockerfile, will be picked up by my_init
-
We ignore HOME, SHELL, USER and a bunch of other environment variables on purpose, because not ignoring them will break multi-user containers.
-
modify the environment variables in my_init (and therefore the environment variables in all child processes that are spawned after that point in time), by altering the files in /etc/container_environment
-
syslog-ng is started separately before the runit supervisor process, and shutdown after runit exits.