更多内容,请查看博客原文:Docker容器中使用systemctl报错Failed to get D-Bus connection: Operation not permitted
在Docker容器中执行systemctl命令时,无论是启动nginx, 或者是vsftpd等服务,都会报如下错误。
systemctl status vsftpd
Failed to get D-Bus connection: Operation not permitted
解决方法
- 在启动容器时,需要加上
--privileged参数来添加权限。 - 不能使用默认的bash,而需要执行
/usr/sbin/init
执行命令:
docker run -dit --privileged <image_id> /usr/sbin/init
以下我们以安装启动vsftpd服务来例子来讲解。
启动centos的容器
更多内容,请查看博客原文:Docker容器中使用systemctl报错Failed to get D-Bus connection: Operation not permitted

1176

被折叠的 条评论
为什么被折叠?



