注意: 这是 https://hub.docker.com/_/nginx 的 s390x 架构专用仓库 — 更多信息,请参见官方镜像文档中的 https://github.com/docker-library/official-images#architectures-other-than-amd64 和官方镜像常见问题中的 https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what%E3%80%82
-** 维护者:**https://github.com/nginxinc/docker-nginx
-** 帮助支持:**Docker 社区 Slack、Server Fault、Unix & Linux 或 Stack Overflow
Dockerfile 链接https://github.com/nginx/docker-nginx/blob/c3785f2653008f9354c3d29a54d8c5459c53fa60/mainline/debian/Dockerfile
https://github.com/nginx/docker-nginx/blob/c3785f2653008f9354c3d29a54d8c5459c53fa60/mainline/debian-perl/Dockerfile
https://github.com/nginx/docker-nginx/blob/c3785f2653008f9354c3d29a54d8c5459c53fa60/mainline/alpine/Dockerfile
https://github.com/nginx/docker-nginx/blob/c3785f2653008f9354c3d29a54d8c5459c53fa60/mainline/alpine-perl/Dockerfile
https://github.com/nginx/docker-nginx/blob/c3785f2653008f9354c3d29a54d8c5459c53fa60/mainline/alpine-slim/Dockerfile
https://github.com/nginx/docker-nginx/blob/9b549fdf936778810dbe95a4813899c60444ef1c/stable/debian/Dockerfile
https://github.com/nginx/docker-nginx/blob/7f1d49f6f222f7e588a9066fd53a0ce43c3466a5/stable/debian-perl/Dockerfile
https://github.com/nginx/docker-nginx/blob/7f1d49f6f222f7e588a9066fd53a0ce43c3466a5/stable/alpine/Dockerfile
https://github.com/nginx/docker-nginx/blob/7f1d49f6f222f7e588a9066fd53a0ce43c3466a5/stable/alpine-perl/Dockerfile
https://github.com/nginx/docker-nginx/blob/9b549fdf936778810dbe95a4813899c60444ef1c/stable/alpine-slim/Dockerfile
-** 问题反馈地址:**https://github.com/nginxinc/docker-nginx/issues?q=
-** 支持的架构:**(https://github.com/docker-library/official-images#architectures-other-than-amd64) https://hub.docker.com/r/amd64/nginx/%E3%80%81https://hub.docker.com/r/arm32v5/nginx/%E3%80%81https://hub.docker.com/r/arm32v6/nginx/%E3%80%81https://hub.docker.com/r/arm32v7/nginx/%E3%80%81https://hub.docker.com/r/arm64v8/nginx/%E3%80%81https://hub.docker.com/r/i386/nginx/%E3%80%81https://hub.docker.com/r/mips64le/nginx/%E3%80%81https://hub.docker.com/r/ppc64le/nginx/%E3%80%81https://hub.docker.com/r/riscv64/nginx/%E3%80%81https://hub.docker.com/r/s390x/nginx/
-** 镜像制品详情:**https://github.com/docker-library/repo-info/blob/master/repos/nginx (https://github.com/docker-library/repo-info/commits/master/repos/nginx)%EF%BC%88%E9%95%9C%E5%83%8F%E5%85%83%E6%95%B0%E6%8D%AE%E3%80%81%E4%BC%A0%E8%BE%93%E5%A4%A7%E5%B0%8F%E7%AD%89%EF%BC%89
-** 镜像更新:**https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fnginx%E3%80%81https://github.com/docker-library/official-images/blob/master/library/nginx (https://github.com/docker-library/official-images/commits/master/library/nginx)
-** 本文档来源:**https://github.com/docker-library/docs/tree/master/nginx (https://github.com/docker-library/docs/commits/master/nginx)
Nginx(发音为 "engine-x")是一款开源的反向代理服务器,支持 HTTP、HTTPS、SMTP、POP3 和 IMAP 协议,同时也可用作负载均衡器、HTTP 缓存和 Web 服务器(源服务器)。Nginx 项目最初就以高并发、高性能和低内存占用为核心目标。它采用 2 条款 BSD 类许可证授权,可运行在 Linux、BSD 变体、Mac OS X、Solaris、AIX、HP-UX 以及其他类 Unix 系统上,也提供了 Windows 系统的概念验证版本。
***.org/wiki/Nginx
!https://raw.githubusercontent.com/docker-library/docs/01c***b2fe592c1f93a13b4e289ada0e3a1/nginx/logo.png
console$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d s390x/nginx
或者,可通过简单的 Dockerfile 生成包含必要内容的新镜像(这比上述绑定挂载方式更简洁):
dockerfileFROM s390x/nginx COPY static-html-directory /usr/share/nginx/html
将此文件与内容目录("static-html-directory")放在同一目录下,然后运行以下命令构建并启动容器:
console$ docker build -t some-content-nginx . $ docker run --name some-nginx -d some-content-nginx
console$ docker run --name some-nginx -d -p 8080:80 some-content-nginx
之后,可在浏览器中访问 http://localhost:8080 或 http://host-ip:8080。
可通过挂载配置文件或构建新镜像来自定义配置。
若需修改默认配置,可通过以下命令从运行中的 nginx 容器获取默认配置:
console$ docker run --rm --entrypoint=cat s390x/nginx /etc/nginx/nginx.conf > /host/path/nginx.conf
然后在主机文件系统中编辑 /host/path/nginx.conf。
有关 nginx 配置文件语法的信息,请参见 官方文档(特别是 入门指南)。
console$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d s390x/nginx
dockerfileFROM s390x/nginx COPY nginx.conf /etc/nginx/nginx.conf
如果在 Dockerfile 中添加自定义 CMD,请确保在 CMD 中包含 -g daemon off;,以使 nginx 保持在前台运行,这样 Docker 才能正确跟踪进程(否则容器启动后会立即停止)!
然后通过 docker build -t custom-nginx . 构建镜像,并按以下方式运行:
console$ docker run --name my-custom-nginx-container -d custom-nginx
默认情况下,s390x/nginx 不支持在大多数配置块中使用环境变量。但本镜像提供了一个功能,可在 nginx 启动前提取环境变量。
以下是使用 compose.yaml 的示例:
yamlweb: image: s390x/nginx volumes: - ./templates:/etc/nginx/templates ports: - "8080:80" environment: - NGINX_HOST=foobar.com - NGINX_PORT=80
默认情况下,此功能会读取 /etc/nginx/templates/*.template 中的模板文件,并将 envsubst 执行结果输出到 /etc/nginx/conf.d。
因此,若创建 templates/default.conf.template 文件,其中包含如下变量引用:
listen ${NGINX_PORT};
则会输出到 /etc/nginx/conf.d/default.conf,内容如下:
listen 80;
可通过以下环境变量修改此行为:
NGINX_ENVSUBST_TEMPLATE_DIR:包含模板文件的目录(默认:/etc/nginx/templates)。若目录不存在,模板处理功能将不执行任何操作。NGINX_ENVSUBST_TEMPLATE_SUFFIX:模板文件的后缀(默认:.template)。仅处理以此后缀结尾的文件。NGINX_ENVSUBST_OUTPUT_DIR:envsubst 执行结果的输出目录(默认:/etc/nginx/conf.d)。输出文件名是去除后缀后的模板文件名(例如:/etc/nginx/templates/default.conf.template 将输出为 /etc/nginx/conf.d/default.conf)。此目录必须可由运行容器的用户写入。要以只读模式运行 s390x/nginx,需将 Docker 卷挂载到 s390x/nginx 写入信息的所有位置。默认 s390x/nginx 配置要求对 /var/cache/nginx 和 /var/run 具有写入权限。可通过以下命令轻松实现:
console$ docker run -d -p 80:80 --read-only -v $(pwd)/nginx-cache:/var/cache/nginx -v $(pwd)/nginx-pid:/var/run nginx
如果有更复杂的配置要求 nginx 写入其他位置,只需为这些位置添加更多卷挂载即可。
1.9.8 及以上版本的镜像包含 nginx-debug 二进制文件,在使用更高日志级别时会生成详细输出。可通过简单的 CMD 替换使用:
console$ docker run --name my-nginx -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d s390x/nginx nginx-debug -g 'daemon off;'
compose.yaml 中的类似配置如下:
yamlweb: image: s390x/nginx volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro command: [nginx-debug, '-g', 'daemon off;']
自 1.19.0 版本起,添加了详细的 entrypoint 输出,用于显示容器启动过程中的信息。可通过设置环境变量 NGINX_ENTRYPOINT_QUIET_LOGS 禁用此输出:
console$ docker run -d -e NGINX_ENTRYPOINT_QUIET_LOGS=1 s390x/nginx
自 1.17.0 版本起,基于 Alpine 和 Debian 的镜像变体均使用相同的用户和组 ID 来降低工作进程的权限:
console$ id uid=101(nginx) gid=101(nginx) groups=101(nginx)
可以以非特权的任意 UID/GID 运行镜像。但这需要修改 s390x/nginx 配置,以使用该 UID/GID 对可写的目录:
console$ docker run -d -v $PWD/nginx.conf:/etc/nginx/nginx.conf s390x/nginx
当前目录下的 nginx.conf 应重新定义以下指令:
nginxpid /tmp/nginx.pid;
并在 http 上下文中添加:
nginxhttp { client_body_temp_path /tmp/client_temp; proxy_temp_path /tmp/proxy_temp_path; fastcgi_temp_path /tmp/fastcgi_temp; uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; ... }
或者,可查看官方的 https://hub.docker.com/r/nginxinc/nginx-unprivileged%E3%80%82
s390x/nginx 镜像有多种版本,每种版本
以下是 s390x/nginx 相关的常用 Docker 镜像,适用于 反向代理、负载均衡、静态资源服务 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务