1 回答

TA貢獻1884條經驗 獲得超4個贊
查看當前系統中的容器列表
1 2 3 4 | [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1ce9f640478d ubuntu:latest "/bin/bash" 5 minutes ago Exited (0) 14 seconds ago ovcer_the_container 8c342c0c275c ubuntu:latest "/bin/bash" 51 minutes ago Exited (0) 31 minutes ago sharp_bohr |
重新啟動一個容器
1 2 | [root@localhost ~]# docker start ovcer_the_container ovcer_the_container |
查看該容器是否啟動成功
1 2 3 | [root@localhost ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1ce9f640478d ubuntu:latest "/bin/bash" 6 minutes ago Up 7 seconds ovcer_the_container |
使用該容器
由于Docker容器重新啟動的時候,會使用docker run命令時指定的參數運行,,所以容器重新啟動后會運行一個交互式的會話shell
可以使用下列命令
1 2 3 | [root@localhost ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1ce9f640478d ubuntu:latest "/bin/bash" 6 minutes ago Up 7 seconds ovcer_the_container |
- 1 回答
- 0 關注
- 11671 瀏覽
添加回答
舉報