Enter terminal, sudo-i, switch root, input docker-d
Open another terminal, switch root, enter the Docker search Ubuntu, probably the following result:
NAME DESCRIPTION STARS Official automated
Ubuntu Ubuntu is a debian-based Linux operating s ... 2306 [OK]
Ubuntu-upstart Upstart is a event-based replacement for ... [OK]
Torusware/speedus-ubuntu always updated official Ubuntu Docker imag ... [OK]
Tleyden5iwx/ubuntu-cuda ubuntu 14.04 with Cuda drivers pre-installed [OK]
Ubuntu-debootstrap debootstrap--variant=minbase--components ... [OK]
Guilhem/vagrant-ubuntu [OK]
Enter Docker pull Ubuntu and the system will download the image from the first one
After the download is complete, you can enter Docker images to see if the image has been downloaded to a local
Start an Ubuntu container and enter Bash,docker run-it Ubuntu/bin/bash,
It should be possible to see [email protected]:/#, which proves that the container has been successfully activated, and that bash into the container
Modify the root password of the container: passwd until you enter a new password, for example: 123456
Installing Vim,apt-get Install Vim-y
Install the openssh-server of the container, enter Apt-get install Openssh-server-y
After successful installation, Vim/etc/ssh/sshd_config, modify the following two configurations
Permitrootlogin Yes
Usepam No
Start SSH services, service ssh start
Exit the container, enter exit, then enter Docker ps-a to see the container ID
The commit container becomes the new image, for example, called Ubuntu-ssh, enter the Docker commit container ID ubuntu-ssh
Start this mirrored container and map a local idle port (for example 10000) to the container's 22 port and start the container for sshd Docker run-d-P 10000:22 ubuntu-ssh/usr/sbin/sshd-d
Now open the new terminal, enter SSH [email protected]-P 10000, if you can link successfully, will be required to enter the password, input just 123456 can enter the terminal of the container