[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)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章