docker bulid 创建镜像
1,在文件Dockerfile 编写进行build,居于现有镜像centos,打包镜像;
[root@47 home]# cat Dockerfile
from centos
copy index.html /usr/share/nginx/html/index.html
ENV LANG C.UTF-8
2,编辑dockfile文件:
[root@47 home]# ll
-rw-r--r-- 1 root root 80 May 19 17:25 Dockerfile
-rw-r--r-- 1 root root 25 May 19 16:03 index.html
3,创建镜像:
[root@47 home]# docker build -t centostest2:v1.0 . #v1.0 为标签
Sending build context to Docker daemon 9.216 kB
Step 1/3 : FROM centos
---> 5d0da3dc9764
Step 2/3 : COPY index.html /usr/share/nginx/html/index.html
---> c719d53257da
Removing intermediate container 0d60917e1aa2
Step 3/3 : ENV LANG C.UTF-8
---> Running in 1180bc5d7a1c
---> fa870adeba14
Removing intermediate container 1180bc5d7a1c
Successfully built fa870adeba14
4,查看生成的镜像:
[root@47 home]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centostest2 v1.0 fa870adeba14 11 seconds ago 231 MB