docker安装ssh服务后,使用命令systemctl start sshd.service启动SSH,有错误信息

Failed to get D-Bus connection: Operation not permitted

解决方案
1、创建容器:
使用命令 docker rundname centos7 —privileged=true centos:7 /usr/sbin/init

其中,privileged=true 和 /usr/sbin/init 很重要

2、进入容器:
使用docker exec -it centos7 /bin/bash

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注