四处搜寻后,我仍然很困惑你是否可以拥有码头集装箱运行 Ubuntu 并运行初始化系统(暴发户) and syslog, 或不。
我知道 docker 容器是用于运行单个进程而不是完整的操作系统,但我的用例是在各种 Linux 发行版上测试守护进程,确保守护进程在崩溃等情况下成功启动、停止和重新启动,并记录到 syslog 。所以我正在尝试决定是否可以使用 docker 容器来实现此目的,或者也许我会更好Vagrant https://www.vagrantup.com/.
我发现的一些资源令人困惑:
所以基本上我最后需要的是能够运行:
$ initctl start <daemon>
$ initctl stop <daemon>
当然,在创建必要的conf文件之后/etc/init/<daemon>.conf
,并查看日志syslog
.
see
https://github.com/BITPlan/docker-stackoverflowanswers/tree/master/33233329 https://github.com/BITPlan/docker-stackoverflowanswers/tree/master/33233329重复步骤
从 Dockerfile 开始
FROM ubuntu:14.04
构建它:
docker build -t bitplan/ubuntutest:0.1 .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM ubuntu:14.04
---> 0a17decee413
Successfully built 0a17decee413
运行它:
docker run -it bitplan/ubuntutest:0.1 /bin/bash
并检查正在运行的服务:
root@50a738241d03:/# service --status-all
[ ? ] console-setup
[ + ] cron
[ ? ] killprocs
[ ? ] kmod
[ ? ] networking
[ ? ] ondemand
[ - ] procps
[ ? ] rc.local
[ + ] resolvconf
[ - ] rsyslog
[ ? ] sendsigs
[ - ] sudo
[ - ] udev
[ ? ] umountfs
[ ? ] umountnfs.sh
[ ? ] umountroot
[ - ] urandom
您可以看到,在典型的基于操作系统的容器中运行着多个服务。如果你安装更多的东西,比如apache、mysql之类的,就会有更多的服务。
因此,如果您想开始更多这些,我建议您使用
服务启动
服务站
你会发现例如在我们的 docker-mediawiki 镜像的入口点:
https://github.com/BITPlan/docker-mediawiki/blob/master/docker-entrypoint.sh https://github.com/BITPlan/docker-mediawiki/blob/master/docker-entrypoint.sh
参见例如
service mysql start
在那里。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)