vi /data/dockerfile/Dockerfile
FROM nginx:latest
USER nginx
WORKDIR /usr/share/nginx/html
docker build . -t 镜像名:tag
docker run --rm -it --name 容器名 镜像名:tag /bin/bash
vi /data/dockerfile/Dockerfile
FROM nginx:latest
USER nginx
ADD index.html /usr/share/nginx/html/index.html
WORKDIR /usr/share/nginx/html
EXPOSE 80
docker build . -t 镜像名:tag
docker run --rm -it --name nginx -P 镜像名:tag /bin/bash
这时没有-d,启动容器内的nginx,需要在容器内执行 nginx -g "daemon off;"
FROM centos
ENV VER 9.9.4-74.e17_6.1
RUN yum install bind-$VER -y
|