如何启动一个docker容器

1、交互式方式启动

[root@localhost shell]# docker run --name=centos -it centos /bin/bash
[root@ae6422da415e /]# 

当使用exit退出时,容器也会跟着停止

2、守护进程方式启动

[root@localhost shell]# docker run --name=centos -td centos
e99176a97a4f15855f2b89cf3fc34484514f09e436fa64a1fab99046584ed086

进入容器

[root@localhost shell]# docker exec -it centos bash

发表评论

后才能评论