Docker container mounting sshd, better manipulation of the container

1, the container must first run a sshd port
Here Insert Picture Description
2, into the container, the installation sshd

ocker exec -it httpd /bin/bash

After entering the container operations

yum -y install openssh-server openssh-clients
rpm -aq|grep openssh

Here Insert Picture Description
3, start sshd

/usr/sbin/sshd -D &
passwd root    #ssh连接时有的密码

Here Insert Picture Description
Here Insert Picture Description
4, try to connect

docker inspect httpd

Here Insert Picture Description

ssh 172.17.0.2

Here Insert Picture Description
success

Published 139 original articles · won praise 240 · views 10000 +

Guess you like

Origin blog.csdn.net/a13568hki/article/details/103889917