Docker中启动mysql报错: Failed to get D-Bus connection

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker中启动mysql报错: Failed to get D-Bus connection相关的知识,希望对你有一定的参考价值。

docker版本:

[[email protected] ~]# docker versionClient:

 Version:         1.10.3

 API version:     1.22

 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64

 Go version:      go1.6.3

 Git commit:      d381c64-unsupported

 Built:           Thu Aug  4 13:21:17 2016

 OS/Arch:         linux/amd64


Server:

 Version:         1.10.3

 API version:     1.22

 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64

 Go version:      go1.6.3

 Git commit:      d381c64-unsupported

 Built:           Thu Aug  4 13:21:17 2016

 OS/Arch:         linux/amd64123456789101112131415161718

镜像版本


[[email protected] /]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core) 12

    在docker中通过systemctl 启动服务的时候总是报Failed to get D-Bus connection: Operation not permitted 这样的错误提示。


[[email protected] ~]# systemctl start sshd

Failed to get D-Bus connection: Operation not permitted

    解决办法就是在docker run 的时候运行/usr/sbin/init 。比如:


[[email protected] /]# 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"];


以上是关于Docker中启动mysql报错: Failed to get D-Bus connection的主要内容,如果未能解决你的问题,请参考以下文章

docker里启动 sshd 报错"Failed to get D-Bus connection: Operation not permitted"

启动docker报错:Failed to start Docker Application Container Engine.

启动docker报错:Failed to start Docker Application Container Engine.

《Docker系列》Docker安装MySQL报错:mysqld failed while attempting to check config....mysqld: Can‘t read dir

docker无法启动,报错grpc: addrConn.createTransport failed to connect to {unix:///run/containerd/containerd.

Docker-docke服务启动报错:Job for docker.service failed because the control process exited with error code.