如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
本仓库是https://hub.docker.com/_/nginx%E9%92%88%E5%AF%B9%60i386%60%E6%9E%B6%E6%9E%84%E7%9A%84%22%E6%AF%8F%E6%9E%B6%E6%9E%84%22%E4%BB%93%E5%BA%93%E2%80%94%E2%80%94%E6%9B%B4%E5%A4%9A%E4%BF%A1%E6%81%AF%E8%AF%B7%E5%8F%82%E8%A7%81%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8F%E6%96%87%E6%A1%A3%E4%B8%AD%E7%9A%84https://github.com/docker-library/official-images#architectures-other-than-amd64%E5%92%8C%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8FFAQ%E4%B8%AD%E7%9A%84https://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
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)
(镜像元数据、传输大小等)
镜像更新:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fnginx
https://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系统,同时也提供了适用于Microsoft 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 i386/nginx
或者,可通过简单的Dockerfile生成包含必要内容的新镜像(比上述绑定挂载方式更简洁):
dockerfileFROM i386/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 i386/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 i386/nginx
dockerfileFROM i386/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
默认情况下,i386/nginx不支持在大多数配置块中使用环境变量。但此镜像提供了一个功能,可在nginx启动前提取环境变量。
以下是使用compose.yaml的示例:
yamlweb: image: i386/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
/etc/nginx/conf.d)/etc/nginx/templates/default.conf.template将输出为/etc/nginx/conf.d/default.conf要以只读模式运行i386/nginx,需将Docker卷挂载到所有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 i386/nginx nginx-debug -g 'daemon off;'
compose.yaml中的类似配置如下:
yamlweb: image: i386/nginx volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro command: [nginx-debug, '-g', 'daemon off;']
1.19.0及以上版本添加了详细的入口点输出,提供容器启动过程的信息。可通过设置环境变量NGINX_ENTRYPOINT_QUIET_LOGS静默此输出:
console$ docker run -d -e NGINX_ENTRYPOINT_QUIET_LOGS=1 i386/nginx
自1.17.0版本起,基于alpine和debian的镜像变体使用相同的用户和组ID来降低工作进程的权限:
console$ id uid=101(nginx) gid=101(nginx) groups=101(nginx)
可使用较低权限的任意UID/GID运行镜像,但需修改i386/nginx配置以使用该UID/GID对可写目录:
console$ docker run -d -v $PWD/nginx.conf:/etc/nginx/nginx.conf i386/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
i386/nginx镜像有多种版本,适用于不同使用场景。
i386/nginx:<version>这是默认镜像。若不确定需求,建议使用此版本。它既可作为临时容器(挂载源代码并启动容器运行应用),也可作为构建其他镜像的基础。
部分标签可能包含bookworm或t
以下是 i386/nginx 相关的常用 Docker 镜像,适用于 反向代理、负载均衡、静态资源服务 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

来自真实用户的反馈,见证轩辕镜像的优质服务