[Docker]How to run CentOS in Docker container

docker pull centos

docker images

docker run -d -i -p 10000:80 centos

docker ps

 

为什么需要加 -i 的参数:

Nothing is actively running. That makes sense, because we’re not telling the containerized OS to do anything 
— it starts, it doesn’t have anything to do, and so it shuts down immediately. 
Instead we can tell it to run interactively and with a terminal by specifying a couple options:

-i, --interactive
-t, --tty (“allocate a pseudo-TTY”, i.e. a terminal)
(see docker run --help for details)

 

posted @ 2022-11-24 19:26  MoKin_Li  阅读(24)  评论(0)    收藏  举报