In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how ssh connects to docker server". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how ssh connects to docker server".
Mainly talk about how to create a docker service, so that others can connect through ssh to use (take ubuntu as an example) to create containers
An image is required. Partners who have installed an image such as ubuntu should know that if not, you can download one through the docker pull image name.
Create a container in the ubuntu image and map port 50003 of the docker server to port 22 of the container
Docker run-it-d-p 50003VR 22 ubuntu
At this point, we can use docker ps to see that our container has been started.
Enter the container docker exec-it a9cbce70127f / bin/bash via ID
And then we went into the container, that is, in the environment of ubuntu.
Install ssh serverapt-get updateapt-get install passwdapt-get install openssh-server
When you install the ssh service here, it will let you choose the time zone. Just select it with a number. I used 631.
Tips: if you use a command and report that the command cannot be found, you can directly use the apt-get install command name to install the command
Set the password of root through the passwd command
Start the ssh service service ssh start
You can check whether the service is started via ps-e | grep ssh
Modify the configuration file
Open the configuration file through the vim editor
Vim / etc/ssh/sshd_config
Write the following in the configuration file (followed by comments after the # sign)
PubkeyAuthentication yes # enable public key and private key pairing authentication AuthorizedKeysFile .ssh / authorized_keys # Public key file path PermitRootLogin yes # root can log in using ssh
If there is no vim command here, press the next one I said above. In addition, this editor is different from the ordinary one. There are insert mode, command mode and so on. You need to check the specific operation. Here, simply say that after entering the editor, press the I key to enter the insert mode, then edit the file normally, press esc to exit the insert mode, and directly enter: the wq command is to save and exit.
Restart the service service ssh restart
At this point, you can connect remotely, and then open a cmd window through the ssh-p port number, user name @ IP address or other tools to enter the ubuntu environment after successful connection, and you can use the linux command.
Thank you for reading, the above is the content of "how ssh connects to the docker server". After the study of this article, I believe you have a deeper understanding of how ssh connects to the docker server, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.