在哪里可以找到docker的nginx(stable)?

在哪里可以找到docker的nginx(stable)?,docker,nginx,Docker,Nginx,我正在尝试制作一个dockerfile,其中包含使用vts模块编译的Nginx stable最新版本。。。。我遇到了一个大问题,当我放入docker文件时,我找不到一些自动链接,它将下载并安装最新的稳定nginx。我只能指定一个版本,如1.14.2。是否有办法修改docker文件,使其始终下载最新版本,而不是只下载一个版本 这是我的文件 FROM debian:stretch-slim RUN apt-get update && \ apt-get install

我正在尝试制作一个dockerfile,其中包含使用vts模块编译的Nginx stable最新版本。。。。我遇到了一个大问题,当我放入docker文件时,我找不到一些自动链接,它将下载并安装最新的稳定nginx。我只能指定一个版本,如1.14.2。是否有办法修改docker文件,使其始终下载最新版本,而不是只下载一个版本

这是我的文件

FROM debian:stretch-slim




RUN apt-get update && \
    apt-get install -y git wget libreadline-dev libncurses5-dev libpcre3-    dev libssl-dev perl make build-essential zlib1g-dev && \
    cd /tmp/ && \
    wget http://nginx.org/download/nginx-1.14.2.tar.gz && \
    git clone git://github.com/vozlt/nginx-module-vts.git && \
    tar zxvf nginx-1.14.2.tar.gz && \
    rm -f nginx-1.14.2.tar.gz && \
    cd nginx-1.14.2 && \
    ./configure --prefix=/tmp/nginx-1.14.2 --sbin-path=/usr/sbin/nginx --    modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock --http-client-body-temp-    path=/var/cache/nginx/client_temp --http-proxy-temp-    path=/var/cache/nginx/proxy_temp \
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-    temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-    path=/var/cache/nginx/scgi_temp \
    --user=nginx --group=nginx --with-compat --with-file-aio --with-    threads --with-http_addition_module --with-http_auth_request_module \
    --with-http_dav_module --with-http_flv_module --with-    http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module \
    --with-http_random_index_module --with-http_realip_module --with-    http_secure_link_module --with-http_slice_module --with-http_ssl_module \
    --with-http_stub_status_module --with-http_sub_module --with-    http_v2_module --with-mail --with-mail_ssl_module --with-stream \
    --with-stream_realip_module --with-stream_ssl_module --with-    stream_ssl_preread_module \
    --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-    1.14.2/debian/debuild-base/nginx-1.14.2=. -specs=/usr/share/dpkg/no-pie-    compile.specs -fstack-protector-strong -Wformat -Werror=format-security -    Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
    --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -    Wl,-z,now -Wl,--as-needed -pie' \
    --add-module=/tmp/nginx-module-vts && \
    make && make install && \
    cp -f objs/nginx /usr/sbin/nginx && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

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

如果您正在寻找一种简单的方法,在从源代码处编译nginx时继续使用稳定版本,因为它没有一个直接的url,那么您可以像下面这样向Dockerfile传递一个:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
然后运行如下的build命令,根据传递的参数继续下载nginx版本:

docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
但是,如果您正在寻找如何在自定义模块中继续使用nginx的官方docker映像-假设您使用的所有自定义模块都支持动态模块功能,如vts模块-,那么您可以通过使用和利用nginx功能来实现

据介绍,支持将模块编译为动态模块,因此可以进行多阶段构建,使用所需的模块编译nginx,然后将生成的文件复制到具有相同版本的nginx映像,以使其正常工作

Nginx稳定图像可以在标有
stable
word的标签中找到

您现在需要做的就是修改Dockerfile并使其使用dynamic modules方式,然后添加另一个阶段,以便将稳定映像与从第一个阶段生成的新模块一起使用,并且您可以在构建过程中添加参数,例如:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
并按如下方式运行构建:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .

更新:

Nginx不提供每次都可以用来获取稳定版本的一个链接,因此您可以像下面那样解析下载页面的html,以获取稳定版本的最新下载链接:

我们依赖HTML页面,从长远来看,HTML页面并不是最健壮的解决方案

输出:

http://nginx.org/download/nginx-1.14.2.tar.gz
在Dockerfile中,它可以是这样的:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
确保安装了curl


如果您正在寻找一种简单的方法,在从源代码处编译nginx时继续使用稳定版本,因为它没有一个直接的url,那么您可以像下面这样向Dockerfile传递一个:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
然后运行如下的build命令,根据传递的参数继续下载nginx版本:

docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
但是,如果您正在寻找如何在自定义模块中继续使用nginx的官方docker映像-假设您使用的所有自定义模块都支持动态模块功能,如vts模块-,那么您可以通过使用和利用nginx功能来实现

据介绍,支持将模块编译为动态模块,因此可以进行多阶段构建,使用所需的模块编译nginx,然后将生成的文件复制到具有相同版本的nginx映像,以使其正常工作

Nginx稳定图像可以在标有
stable
word的标签中找到

您现在需要做的就是修改Dockerfile并使其使用dynamic modules方式,然后添加另一个阶段,以便将稳定映像与从第一个阶段生成的新模块一起使用,并且您可以在构建过程中添加参数,例如:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
并按如下方式运行构建:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .

更新:

Nginx不提供每次都可以用来获取稳定版本的一个链接,因此您可以像下面那样解析下载页面的html,以获取稳定版本的最新下载链接:

我们依赖HTML页面,从长远来看,HTML页面并不是最健壮的解决方案

输出:

http://nginx.org/download/nginx-1.14.2.tar.gz
在Dockerfile中,它可以是这样的:

...
ARG NGINX_STABLE_VERSION
RUN   wget http://nginx.org/download/nginx-${NGINX_STABLE_VERSION}.tar.gz
...
docker build --build-arg NGINX_STABLE_VERSION=1.14.2 .
确保安装了curl


你给了我一个很好的解决方案,但我希望它能找到最新的稳定版本并下载它,而无需我放入该版本,即使我使用ansible来实现它,这是可能的吗?Nginx不提供直接指向稳定版本的一个链接。你必须得到这个版本。另一个解决方案是解析下载页面的html以自动获取链接。你给了我一个很好的解决方案,但我希望它能找到最新的稳定版本并下载,而无需我放置版本,即使我使用ansible来实现,这是可能的吗?Nginx不提供一个链接直接到稳定版本。你必须得到这个版本。另一个解决方案是解析下载页面的html以自动获取链接,但从长远来看这不是一个好的解决方案。