在我的笔记本电脑上使用ubuntu 16.04 64位
当我做sudo /proc/1/exe --version
时
我得到
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN
但是当我在图像ubuntu-upstart
我得到了
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
我有一个ubuntu虚拟机,在其中我安装了与上面提到的相同图像的docker容器我得到了
exe (upstart 1.12.1)
Copyright (C) 2006-2014 Canonical Ltd., 2011 Scott James Remnant
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
我的问题是为什么对于第二种情况我得到GNU bash结果而没有关于服务管理器的信息,无论是systemd还是upstart
答案 0 :(得分:0)
默认的docker init进程(入口点)在Dockerfile中定义;它不必与docker镜像所基于的操作系统的init进程相同,如果有的话。您也可以使用docker run -it --entrypoint=bash
运行另一个而不重建docker镜像。 (从技术上讲,使用init=
内核参数启动具有引导加载程序的真实机器时,您也曾经使用Linux内核做同样的事情,尽管我不认为这支持任何内容。更多,至少在我使用的Fedora Linux上。)
有时Dockerfile编写者使用bash或简单的脚本作为入口点,因为他们不需要像supervisord
或systemd
这样的主管提供的复杂性。