Skip to content

SSH Docker container

System has not been booted with systemd as init system (PID 1). Can't operate.Failed to connect to bus: Host is down


解决方法:

docker run -itd  --privileged --name centos centos /usr/sbin/init
docker run -itd  --privileged --name centos centos /usr/sbin/init

创建完成后,请使用以下命令进入容器:

docker exec -it centos /bin/bash
docker exec -it centos /bin/bash

安装openssh服务器端、客户端等工具:

yum install passwd openssl openssh-server openssh-clients initscripts -y
yum install passwd openssl openssh-server openssh-clients initscripts -y

启动 ssh,systemctl start sshd