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

Explain in detail how Docker starts a Centos image

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Then, after we download a Centos image, we start to launch it.

# run the command

Docker run-d-I-t / bin/bash

In this way, you can start a Centos that has been running in the background. If / bin/bash is missing, Docker will generate a Container but will stop immediately and will not run consistently even with the-d argument.

Then we can enter our Centos.

Docker attach

After entering Centos, I found that there were no ifconfig and ssh. Many online examples refer to them.

Installation of ifconfig, execute command

Yum search ifconfig

two。 Install ifconfig

Yum install net-tools.x86_64

Well, with it, you can finally know your own IP and network. Now we still need a ssh so that we can easily access Centos.

Then all you have to do is start it.

/ usr/sbin/sshd-D

Then there is the common command to map the port to the host, and here I am the linux system assigned by VM.

# exit, but do not stop container Ctrl+P+Q# returning to Docker, stop container docker stop # submit current container to mirror docker commit # start new container, and do port mapping docker run-itd-p 50001docker stop 22 / bin/bash

All right, so we can access the container by using the ssh tool to access the IP port of the host under windows.

Here I am, 192.168.99.100VR 50001.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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