Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to log in to docker through SSH

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to log in to docker through SSH", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to log in to docker through SSH" article.

Specify the mapped port docker run when creating the container-- name test-dit-p 8022 dit 22 2c886f766286 / bin/bash

In addition, you can also see whether the corresponding port is monitored by the docker container on the host.

Netstat-tunlptcp6 0 0: 8022: * modify the root password in the LISTEN 24209/docker-proxy login container Install the openssh service docker exec-ti test / bin/bash [root@84641e8d0f74 /] # passwd # modify the password of the centos system ROOT account in the container [root@84641e8d0f74 /] # yum-y install openssh* # install the openssh service [root@84641e8d0f74 /] # service sshd start host add port to release iptables-An INPUT-p tcp-- dport 8022-j ACCEPTservice iptables save

Remote login test, login is successful!

To facilitate future use, you can save the container with ssh login enabled as the image name docker images created by the docker commit 84641e8d0f74 centos_6.6_ssh # container ID. You can see that the image has been created successfully. The next time you need to create a new container, you can use the image directly. The above is the content of this article on "how to log in to docker through SSH". I believe you all have some understanding. I hope the content shared by the editor will be helpful to all of you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report