1.dockerFile定制镜像
定义一个nginx配置文件
FROM nginx RUN echo '这是一个本地构建的nginx镜像' > /usr/share/nginx/html/index.html
[root@qicheng Dockerfile]# docker build -t nginx:v3 . Sending build context to Docker daemon 2.048kB Step 1/2 : FROM nginx latest: Pulling from library/nginx 852e50cd189d: Pull complete a29b129f4109: Pull complete b3ddf1fa5595: Pull complete c5df295936d3: Pull complete 232bf38931fc: Pull complete Digest: sha256:c3a1592d2b6d275bef4087573355827b200b00ffc2d9849890a4f3aa2128c4ae Status: Downloaded newer image for nginx:latest ---> daee903b4e43 Step 2/2 : RUN echo '这是一个本地构建的nginx镜像' > /usr/share/nginx/html/index.html ---> Running in 1d773667d025 Removing intermediate container 1d773667d025 ---> ed8d27c2e297 Successfully built ed8d27c2e297 Successfully tagged nginx:v3