In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install docker on a Linux system and log in to the docker container with ssh. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Description: I am using Centos to install docker
Step 1: 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 installed before, so the system does not need to update most things.
If you want to install other versions of docker under Linux, you can go to this URL to take a look at the installation commands:
Https://download.daocloud.io/Docker_Mirror/Docker clicks on the open link
Step 2: configure the docker accelerator
Register an account under DaoCloud (www.daocloud.io), pull it down to the end, and then click on the Accelerator
Copy the code for this configuration accelerator and run
Step 3: install the ubuntu system on docker
Docker search ubuntu to see which versions of ubuntu images are available.
Docker search ubuntu
I used docker pull ubuntu to download the first one directly:
Docker images to view the downloaded docker image:
Docker run-tid-- name ubuntu-p 23:22 ubuntu: name the newly created docker ubuntu and map it to port 23
Netstat-apnl | grep 23 to see if port 23 is open
You can see that port 23 is open.
Docker exec-ti ubuntu / bin/bash enters the Ubuntu of docker (or use dockerrun-I-t ubuntu / bin/bash) and changes the password of root through the passwd command.
Step 4: log in to the docker container with ssh
Apt install-y vim install (update) vim
Because unable to locate package appears, you need to update the source.
Then install openssh-server: apt install-y openssh-server
After a successful installation, vim / etc/ssh/sshd_config, modify the following configuration so that you can log in directly using root:
1) add PermitRootLogin yes
I commented out the above sentence and added the sentence "PermitRootLogin yes".
2) add UsePAM no
Start the ssh service, service sshstart
Exit exits docker, enter docker ps-a to view the ID of docker
Open a new terminal and enter docker via ssh root@39.108.165.202-p 23:
Or directly configure to set up a new session in xshell, add the port number we set earlier (23), or log in.
Let me remind you: the server I use is Aliyun. Many ports of Aliyun are not enabled by default, and the port 23 I set is not open either. Pay attention to enable it in the Aliyun console, or you will not enter the ssh.
Step 5: we can also store this ubuntu image:
Using sudo docker save-o ubuntu.zip ubuntu will store it in the current directory.
Then load the image on any machine:
Step 6: if we don't like the existing image, we can delete it:
View the ID of the installation container
Close the docker container before deleting:
Then delete: docker rm + install the ID of the container
You can see that there is no container working, so it can't be uploaded now.
At this point, the Linux system installs docker and logs in to the docker container with ssh.
Thank you for reading! This is the end of the article on "how to install docker in the Linux system and log in to the docker container with ssh". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.