docker版本:
[root@localhost gae_proxy]# docker version client: version: 1.10.3 api version: 1.22 package version: dockermon-1.10.3-46.el7.centos.10.x86_64 go version: go1.6.3 git mit: d381c64-unsupported built: thu aug 4 13:21:17 2022 os/arch: linux/amd64 server: version: 1.10.3 api version: 1.22 package version: dockermon-1.10.3-46.el7.centos.10.x86_64 go version: go1.6.3 git mit: d381c64-unsupported built: thu aug 4 13:21:17 2022 os/arch: linux/amd64
镜像版本
[root@b2ca5610d3da /]# cat /etc/redhat-release centos linux release 7.2.1511 (core)
在docker中通过systemctl 启动服务的时候总是报failed to get d-bus connection: operation not permitted 这样的错误提示。
[root@25d27693a24d ~]# systemctl start sshd failed to get d-bus connection: operation not permitted
解决办法就是在docker run 的时候运行/usr/sbin/init 。比如:
[root@localhost /]# docker run -tid --name hadoopbase centos/hadoopbase:v001 /usr/sbin/init
这样运行起来的container就可以使用systemctl来启动服务了,有的人说在centos7.2中解决了通过systemctl运行报错的问题,但是我在实际操作中还是遇到这样的问题。
还有一种解决办法,就是在通过dockerfile生成镜像文件的时候,通过cmd来执行/usr/sbin/init这条命令,即:cmd [ "/usr/sbin/init"];









