操作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