nginx之dockerfile编写方法
下文笔者讲述nginx之dockerfile的编写方法分享,如下所示
例:nginx之dockerfile
FROM nginx:1.22.1 MAINTAINER "java265" RUN groupadd --system -g 2000 app \ && useradd app --system -m -s /bin/bash -u 2000 -g 2000 \ && usermod -a -G nginx app WORKDIR /home/app #COPY app/start.sh . #COPY app/docker-entrypoint-init.d docker-entrypoint-init.d #COPY app/docker-entrypoint.sh /usr/local/bin/ COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/ COPY etc/nginx/nginx.conf /etc/nginx/ #RUN chmod +x /usr/local/bin/docker-entrypoint.sh \ # && ln -s /usr/local/bin/docker-entrypoint.sh /entrypoint.sh RUN mkdir -p /home/app/log && mkdir -p /var/run/nginx \ && chown -R app:app /home/app/log \ && chown -R nginx:nginx /var/log/nginx \ && chown -R nginx:nginx /var/cache/nginx \ && chown -R nginx:nginx /usr/lib/nginx \ && chown -R nginx:nginx /var/cache/nginx \ && chown -R nginx:nginx /var/run/nginx \ && chmod -R 775 /var/cache/nginx \ && chmod -R 775 /var/log/nginx \ && chown nginx:nginx /usr/sbin/nginx \ && chmod a+s /usr/sbin/nginx USER nginx #ENTRYPOINT ["docker-entrypoint.sh"]例2
FROM nginx:1.22.1 MAINTAINER "java265" RUN cp /etc/apt/sources.list /etc/apt/sources.list.backup \ && sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list \ && apt-get update && apt-get install -y apt-utils RUN apt-get install -y vim wget telnet net-tools tcpdump COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/ COPY etc/nginx/nginx.conf /etc/nginx/ RUN mkdir -p /var/run/nginx && chown -R nginx:nginx /var/run/nginx \ && chown -R nginx:nginx /var/cache/nginx \ && chown -R nginx:nginx /var/log/nginx \ && chown -R nginx:nginx /var/lib/nginx USER nginx
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。