镜像
背景
docker镜像是最小的,被精简过的Linux系统,是不带vim命令的
使用命令 ‘vim a.txt’ 进行新建编辑a.txt文件,就会提示找不到命令
给镜像容器新增vim命令
- 更新镜像 - apt-get update 
 
- 下载vim功能 - apt-get -y install vim 
 
- 提交副本使成为一个新镜像 - docker commit -m=”提交的描述信息” -a=”作者” 容器id 要创建的目标镜像名:[标签名] 
 
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 
 | [root@iZ8vbfaek3x3ogtpxnpnwfZ /]# docker psCONTAINER ID   IMAGE               COMMAND   CREATED       STATUS       PORTS     NAMES
 356e32244966   mytest/ubuntu:3.5   "bash"    2 hours ago   Up 2 hours             elated_aryabhata
 [root@iZ8vbfaek3x3ogtpxnpnwfZ /]#
 [root@iZ8vbfaek3x3ogtpxnpnwfZ /]# docker commit -m="vim cmd add ok" -a="ggls" 356e32244966 ggls/ubuntu:1.5
 sha256:87e99e19eeef47d4f0daaffc8498690614e0d95eae60ef61b439abe97b62fd16
 [root@iZ8vbfaek3x3ogtpxnpnwfZ /]# docker images
 REPOSITORY      TAG       IMAGE ID       CREATED         SIZE
 ggls/ubuntu     1.5       87e99e19eeef   7 seconds ago   176MB
 mytest/ubuntu   3.5       a92a27affdde   2 hours ago     72.8MB
 tomcat          9.0       b8e65a4d736d   4 months ago    680MB
 ubuntu          latest    ba6acccedd29   6 months ago    72.8MB
 redis           6.0.8     16ecd2772934   18 months ago   104MB
 [root@iZ8vbfaek3x3ogtpxnpnwfZ /]#
 
 |