
如果你使用 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 的 mips64le 架构构建的“每架构”仓库——更多信息,请参见官方镜像文档中的“https://github.com/docker-library/official-images#architectures-other-than-amd64%E2%80%9D%E4%BB%A5%E5%8F%8A%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8FFAQ%E4%B8%AD%E7%9A%84%E2%80%9Chttps://github.com/docker-library/faq#an-images-source-changed-in-git-now-what%E2%80%9D%E3%80%82
-** 维护者 **:
https://github.com/nginxinc/docker-nginx
-** 获取帮助的地方 **:
https://dockr.ly/comm-slack%E3%80%81Server Fault、https://unix.stackexchange.com/help/on-topic 或 https://stackoverflow.com/help/on-topic
Dockerfile 链接https://github.com/nginx/docker-nginx/blob/9b549fdf936778810dbe95a4813899c60444ef1c/stable/debian/Dockerfile
https://github.com/nginx/docker-nginx/blob/7f1d49f6f222f7e588a9066fd53a0ce43c3466a5/stable/debian-perl/Dockerfile
-** 提交issue的地方 **:
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/
-** 已发布镜像 artifact 详情 **:
https://github.com/docker-library/repo-info/blob/master/repos/nginx%EF%BC%88https://github.com/docker-library/repo-info/commits/master/repos/nginx%EF%BC%89
(镜像元数据、传输大小等)
-** 镜像更新 **:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fnginx
https://github.com/docker-library/official-images/blob/master/library/nginx%EF%BC%88https://github.com/docker-library/official-images/commits/master/library/nginx%EF%BC%89
-** 本描述的来源 **:
https://github.com/docker-library/docs/tree/master/nginx%EF%BC%88https://github.com/docker-library/docs/commits/master/nginx%EF%BC%89
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 mips64le/nginx
或者,可以使用简单的 Dockerfile 生成包含必要内容的新镜像(这比上面的绑定挂载更简洁):
dockerfileFROM mips64le/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 mips64le/nginx /etc/nginx/nginx.conf > /host/path/nginx.conf
然后在主机文件系统中编辑 /host/path/nginx.conf。
有关nginx配置文件语法的信息,请参见http://nginx.org/en/docs/%EF%BC%88%E7%89%B9%E5%88%AB%E6%98%AFhttp://nginx.org/en/docs/beginners_guide.html#conf_structure%EF%BC%89%E3%80%82
console$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d mips64le/nginx
dockerfileFROM mips64le/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
默认情况下,mips64le/nginx不支持在大多数配置块中使用环境变量。但本镜像提供了一个函数,可在mips64le/nginx启动前提取环境变量。
以下是使用 compose.yaml 的示例:
yamlweb: image: mips64le/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。要以只读模式运行mips64le/nginx,需要将Docker卷挂载到mips64le/nginx写入信息的所有位置。默认的mips64le/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
如果您的高级配置要求mips64le/nginx写入其他位置,只需为这些位置添加更多卷挂载。
1.9.8版本及以上的镜像包含 nginx-debug 二进制文件,在使用较高日志级别时会生成详细输出。可通过简单的CMD替换使用:
console$ docker run --name my-nginx -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d mips64le/nginx nginx-debug -g 'daemon off;'
compose.yaml 中的类似配置如下:
yamlweb: image: mips64le/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 mips64le/nginx
从1.17.0版本开始,基于alpine和debian的镜像变体使用相同的用户和组ID来降低工作进程的权限:
console$ id uid=101(nginx) gid=101(nginx) groups=101(nginx)
可以以较低权限的任意UID/GID运行镜像。但这需要修改mips64le/nginx配置,使用该特定UID/GID对可写入的目录:
console$ docker run -d -v $PWD/nginx.conf:/etc/nginx/nginx.conf mips64le/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
mips64le/nginx 镜像有多种版本,每种版本针对特定用例设计。
mips64le/nginx:<version>这是默认镜像。如果不确定需求,建议使用此版本。它既可作为临时容器(挂载源代码并启动容器以运行应用),也可作为构建其他镜像的基础。
某些标签可能包含如bookworm之类的名称,这些是 https://wiki.debian.org/DebianReleases 发行版的代号,表示镜像基于哪个发行版。如果您的镜像需要安装除镜像自带软件之外的其他包,建议明确指定其中一个代号,以减少Debian新版本发布时的中断。
mips64le/nginx:<version>-perl / mips64le/nginx:<version>-alpine-perl从mips64le/nginx:1.13.0 / mainline和mips64le/nginx:1.12.0 / stable开始,perl模块已从默认镜像中移除。如果需要使用perl模块,可使用单独的 -perl 标签变体。
查看本镜像所包含软件的 http://nginx.org/LICENSE%E3%80%82
与所有Docker镜像一样,这些镜像可能还包含其他软件,这些软件可能采用其他许可证(如基础发行版中的Bash等,以及主要软件的任何直接或间接依赖项)。
一些能够自动检测到的额外许可证信息可能位于 https://github.com/docker-library/repo-info/tree/master/repos/nginx 中。
对于任何预构建镜像的使用,镜像用户有责任确保对本镜像的任何使用都符合其中包含的所有软件的相关许可证。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 mips64le/nginx 相关的常用 Docker 镜像,适用于 反向代理、负载均衡、静态资源服务 等不同场景: