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 the docker container remotely

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to log in to the docker container remotely". 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 to log in to the docker container remotely".

Container Management: kitematic for windows

Remote connection tool: xshell

Container system: ubuntu

Download the ubuntu container

Download the latest official version of ubuntu from ketematic

II. Preparatory work

Because many commands are not available in the newly installed official ubuntu, you need to install it yourself.

Apt-get updateapt-get install vim

Initialize the password for root

Sudo passwd root (use passwd root if the sudo command does not exist)

Then set the password.

Third, install ssh

Installation

Apt-get install openssh-server

View statu

Service ssh status

Turn on ssh

Service ssh start

Configure ssh and run root login

Vim / etc/ssh/sshd_config

The value of PermitRootLogin changed from prohibit-password to yes

As follows:

-PermitRootLogin prohibit-password + PermitRootLogin yes

Save after editing, and then restart ssh

Service ssh restart

Save changes to the current container

Open through kitematic, or open docker command operation through Docker Quickstart Terminal

Docker ps to see which docker is currently running

You can see what the container ID of the currently running ubuntu is.

Save the new container

Docker commit 66b34b5228d8

Note: syntax is docker commit container ID

Configure the container with an accessible port

Since the port of ssh is 22, we configure an external port to access the port in the container

Once configured, click Save, and the container will restart automatically.

Remarks: 1. External ports can be easily configured with a non-conflicting port.

2. After restarting the container, you may need to restart ssh,service ssh start

Connect the container through xshell and putty

All the above work is done, and we need to access it through the ip address of the docker (not through the ip address of the container, because it needs to be mapped).

Local cmd- "ipconfig to view the ip address of the current docker

You can connect through ssh client tools such as putty or xshell

Thank you for reading, the above is the content of "how to log in to docker container remotely". After the study of this article, I believe you have a deeper understanding of how to log in to docker container remotely, and the specific usage 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.

Share To

Servers

Wechat

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

12
Report