Linux system installation docker and SSH login Docker container __linux

Source: Internet
Author: User
Tags docker ps docker run aliyun

Description: I am using the CentOS installation Docker


First step: Install Docker

sudo yum install-y yum-utils


sudo yum-config-manager     --add-repo     Https://download.daocloud.io/docker/linux/centos/docker-ce.repo


sudo yum install-y-Q--setopt=obsoletes=0 docker-ce-17.09.1.ce* docker-ce-selinux-17.09.1.ce*



sudo systemctl enable Docker
sudo systemctl start docker
sudo service docker status

Note: This is what I have installed before, so the system does not need to update most of the things.

If you want to install the other version of Linux Docker, you can go to this site to look at the installation command:

Https://download.daocloud.io/Docker_Mirror/Docker Click on the Open link


Step Two: Configure the Docker accelerator

Under Daocloud (URL for www.daocloud.io) register an account, pull down to the end and click on the accelerator



Copy the code for this configuration accelerator and run


Step Three: Install the Ubuntu system on the Docker

Docker search Ubuntu See what versions of Ubuntu mirrors

Docker search Ubuntu



I use Docker pull Ubuntu to download the first one directly in:


Docker images view downloaded Docker mirrors:

Docker Run-tid--name ubuntu-p 23:22 ubuntu: Name the new Docker as Ubuntu and map to Port 23



NETSTAT-APNL | grep 23 See if Port 23 is open

You can see that port 23 is open.

Docker Exec-ti Ubuntu/bin/bash into the Docker Ubuntu (or use dockerrun-i-t ubuntu/bin/bash), and then modifies the root password through the passwd command.


Fourth step: with SSH login docker container apt install-y vim Install (update) VIM

Because appear unable to locate package, so want to update the source.

Then install OPENSSH-SERVER:APT install-y openssh-server


After successful installation, Vim/etc/ssh/sshd_config, modify the following configuration, so that you can directly use root login: 1 To add permitrootlogin Yes

I'll comment on the sentence above and add permitrootlogin Yes.


2) Add Usepam No


Start SSH services, service Sshstart

Exit Docker, enter Docker Ps-a, and view the Docker ID


Open a new terminal and enter Docker via SSH root@39.108.165.202-p 23:

Or directly configure a new session in Xshell, add the port number we set before (23), login to enter also.


Remind: I use the server is Aliyun, Aliyun a lot of port default is not open, I set the 23 port also did not open, note to the Aliyun console open, or SSH will not go in.


Step Fifth: We can also store this Ubuntu image:

Using sudo docker save-o ubuntu.zip ubuntu will be stored in the current directory.


And then on any one of the machines to load mirror like:


Sixth Step: If we do not like the existing mirror, we can also delete:

To view the ID of the installation container



Turn off the Docker container before removing it:


Then delete: Docker RM + installation Container ID

You can see that there is no container at work, so now it is not up.


At this point, the Linux system installs Docker and uses SSH login Docker container configuration complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.