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 does Docker start a Centos image?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article "how Docker starts a Centos image", so the editor summarizes the following contents, 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 Docker starts a Centos image" article.

After downloading a centos image, start starting

# 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 content of this article on "how Docker starts a Centos image". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to 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