咨询热线:4006-75-4006

售前:9:00-23:30    备案:9:00-18:00    技术:7*24h

docker报错:Failed to get D-Bus connection Operation not permitted的解决办法

2024-01-05 17:34:13 8725次

docker报错:Failed to get D-Bus connection Operation not permitted的解决办法


问题:

Docker使用centos7镜像创建容器后,在里面使用systemctl启动服务报错:

Failed to get D-Bus connection: Operation not permitted

问题复现:

#docker run -itd --name centos7 centos:7

#docker attach centos7

#yum install vsftpd

image.png

image.png

#systemctl start vsftpd

报错:Failed to get D-Bus connection: Operation not permitted

image.png

解决办法:

先把原先创建的容器停止服务并移除

#docker stop centos7

#docker rm centos7

image.png

以特权模式运行容器。

#docker run -d --name centos7 --privileged=true centos:7 

image.png

进入容器:

#docker exec -it centos7 / bin / bash

#yum install vsftpd

#systemctl start vsftpd

image.png

image.png

启动正常。


首页
最新活动
个人中心