赞
踩
转载:https://www.bilibili.com/video/BV1og4y1q7M4?p=25
没看懂
Dockerfile就是用来构建docker镜像的构建文件!命令脚本!
通过这个脚本可以生成镜像,镜像是一层一层的,每个命令都是一层!
#创建一个dockerfile文件,名字随机,建议Dockerfile
#文件中的内容指令(大写) 参数
FORM centos
VOLUME ["volume01","volume02"]
CMD echo "---end---"
CMD /bin/bash
#这里的每个命令,就是镜像的一层
zzw@zzw-virtual-machine:~/test$ sudo docker build -f /home/zzw/test/dockerfile1 -t zzw/centos:1.0 . Sending build context to Docker daemon 2.048kB Step 1/4 : FROM centos ---> 300e315adb2f Step 2/4 : VOLUME ["volume01","volume02"] ---> Running in 46598825289e Removing intermediate container 46598825289e ---> 491cf89d642b Step 3/4 : CMD echo "---end---" ---> Running in a7b02ade8a97 Removing intermediate container a7b02ade8a97 ---> 952c5b496e8e Step 4/4 : CMD /bin/bash ---> Running in 88470bee0318 Removing intermediate container 88470bee0318 ---> c6dd7d3bbbfe Successfully built c6dd7d3bbbfe Successfully tagged zzw/centos:1.0 zzw@zzw-virtual-machine:~/test$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE zzw/centos 1.0 c6dd7d3bbbfe 13 seconds ago 209MB tomcat latest c0e850d7b9bb 4 days ago 667MB mysql 8.0 0627ec6901db 7 days ago 556MB nginx latest 62d49f9bab67 13 days ago 133MB portainer/portainer latest 580c0e4e98b0 5 weeks ago 79.1MB centos latest 300e315adb2f 4 months ago 209MB
--volumes-form
结论:
容器之间配置信息的传递,数据卷容器的生命周期一直持续到没有容器使用为止。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。