操作Docker容器
容器是Docker的另一个核心概念。简单来说,容器是镜像的一个运行实例。所不同的是,镜像是静态的只读文件,而容器带有运行时需要的可写文件层。
1.创建容器
容器是在镜像的基础上创建的。
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 470671670cac 6 weeks ago 237MB
hello-world latest fce289e99eb9 14 months ago 1.84kB
[root@localhost ~]# docker create -it centos:latest #创建容器
32018a91b1f95c54c7107796b9e70b1ffd3746afabc8f2ab50149897a5436d77
[root@localhost ~]# docker ps