ps :cmd 会被外部参数覆盖,add只能解压tar包
FROM busybox
MAINTAINER ops.attacker.club
ADD *.tar.gz lua-nginx*.zip /usr/local/src/
docker build -t busybox:test1 -f Dockerfile-test .
docker run --rm -it --name host1 busybox:test1 /bin/sh
ADD 支持tar包解压不支持zip
FROM centos:7
MAINTAINER admin@attacker.club
RUN yum install -y gcc gcc-c++ make openssl-devel pcre-devel
ADD nginx-1.12.1.tar.gz /tmp
RUN cd /tmp/nginx-1.12.1 && \
./configure --prefix=/usr/local/nginx && \
make -j 2 && \
make install
RUN rm -rf /tmp/nginx-1.12.1* && yum clean all
COPY nginx.conf /usr/local/nginx/conf
WORKDIR /usr/local/nginx
EXPOSE 80
CMD ["./sbin/nginx", "-g", "daemon off;"]
docker build -t nginx:v1 -f Dockerfile .
#构建镜像
docker run -d -p 80:80 --name nginx-1 nginx:v1