使用 Alpine:Edge 构建 Nginx 1.9.14 版的 Docker 镜像

太长不看

    alpinelinuxのedge branchで nginx 1.9.14の docker imageをbuildする

Dockerfile的中文解释是什么?

FROM alpine:edge

MAINTAINER Takumi Kanzaki

RUN apk upgrade
RUN apk add --no-cache --virtual .nginx-builddeps \
    ca-certificates \
    nginx=1.9.14-r0

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log

# nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf

VOLUME ["/var/cache/nginx"]

EXPOSE 80 443

CMD ["nginx", "-g", "daemon off;"]

构建 Docker 镜像

docker build -t nginx:1.9.14-alpine-edge --no-cache .

确认版本/配置选项

% docker run nginx:1.9.14-apline-edge nginx -V
nginx版本:nginx/1.9.14
使用OpenSSL 1.0.2g构建,于2016年3月1日
启用了TLS SNI支持
配置参数:–prefix=/var/lib/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –pid-path=/run/nginx/nginx.pid –lock-path=/run/nginx/nginx.lock –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi –http-scgi-temp-path=/var/lib/nginx/tmp/scgi –user=nginx –group=nginx –with-ipv6 –with-file-aio –with-pcre-jit –with-http_dav_module –with-http_ssl_module –with-http_stub_status_module –with-http_gzip_static_module –with-http_v2_module –with-http_auth_request_module –with-mail –with-mail_ssl_module

图片尺寸

    alpine:3.3 の nginx1.8.1との比較
-> % docker images | grep nginx
nginx     1.9.14-apline-simple              18c6b823fe55        3 minutes ago       6.746 MB
nginx     1.8.1-apline-simple               7c3832639116        5 hours ago         7.393 MB
广告
将在 10 秒后关闭
bannerAds