運行docker 鏡像
-
進入centos容器
-
yum -y install openssh-server
-
啟動ssh服務
systemctl start sshd
4.修改 /etc/ssh/sshd_config 配置信息
去掉如下注釋
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
permitrootlogin yes
UsePAM yes 改為 UsePAM no
GSSAPICleanupCredentials no改為GSSAPICleanupCredentials yes
去掉UsePrivilegeSeparation sandbox的注釋並改為UsePrivilegeSeparation no
5.重啟sshd
/usr/sbin/sshd -D
6.設置linux容器的密碼
yum install passwd.x86_64
passwd root
可以ssh連接了,又或者可以提交鏡像,再創容器來連接
-
提交鏡像
-
運行新鏡像
-