Get the App
SLTechnology News&Howtos  ›  Development  › 

How does Docker start a Centos image?

Shulou Source: shulou.com Published: 2022-05-31 22:36:18 09月21日 Update

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.

Tags: Mirror content container that is command port run next host host article knowledge article consistency value example parameter background most tools Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Shulou Technology Docker Huawei