
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
If this image helped you, do not skimp on giving a star to it!
Based on php:8.5.7-fpm-alpine3.23, node:26.3.0-alpine3.23 (nodejs is not included in most of other nginx-php images...but needed by a lot of php frameworks), with nginx:alpine and richarvey/nginx-php-fpm's Docker script
php8.4.1_node23.3.0, PHP brotli module is added and swoole module is removed (it doesn't support 8.4 by now).php8.3.6_node22.1.0, PHP imagick module is added.php8.2.8_node20.5.0, PHP mongodb module is added and GD module's JPEG and FreeType support are enabled.php8.1.8_node18.4.0, PHP amqp module is added.php8.1.10_node18.8.0, PHP swoole module is added.php8.1.12, added _withoutNodejs build for some pure PHP API frameworks like https://lumen.laravel.comTags:
NOTE If you are upgrading from PHP 8.0 to 8.1, 8.1 to 8.2, 8.2 to 8.3, 8.3 to 8.4 or 8.4 to 8.5, you may need to run composer update to upgrade php packages, because some packages under 8.0/8.1/8.2/8.3 are not supported in 8.1/8.2/8.3/8.4 .
# php -v PHP 8.5.7 (cli) (built: Jun 5 2026 01:14:17) (NTS) Copyright (c) The PHP Group Built by https://github.com/docker-library/php Zend Engine v4.5.7, Copyright (c) Zend Technologies with Zend OPcache v8.5.7, Copyright (c), by Zend Technologies # node -v v26.3.0 # nginx -v nginx version: nginx/1.31.1
In this image it contains following PHP modules:
[PHP Modules] amqp bcmath brotli Core ctype curl date dom exif fileinfo filter gd gettext hash iconv igbinary imagick imap intl json ldap lexbor libxml mbstring memcached mongodb msgpack mysqli mysqlnd openssl pcre PDO pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix random readline redis Reflection session SimpleXML soap sockets sodium SPL sqlite3 standard tokenizer uri xml xmlreader xmlwriter Zend OPcache zip zlib [Zend Modules] Zend OPcache # php -r "echo sprintf(\"GD SUPPORT %s\n\", json_encode(gd_info()));" GD SUPPORT {"GD Version":"bundled (2.1.0 compatible)","FreeType Support":true,"FreeType Linkage":"with freetype","GIF Read Support":true,"GIF Create Support":true,"JPEG Support":true,"PNG Support":true,"WBMP Support":true,"XPM Support":false,"XBM Support":true,"WebP Support":true,"BMP Support":true,"AVIF Support":false,"TGA Read Support":true,"JIS-mapped Japanese Font Support":false}
For example, use this docker image to deploy a Laravel 11 project.
Dockerfile:
dockerfileFROM tangramor/nginx-php8-fpm # copy source code COPY . /var/www/html # If there is a conf folder under /var/www/html, the start.sh will # copy conf/nginx.conf to /etc/nginx/nginx.conf # copy conf/nginx-site.conf to /etc/nginx/conf.d/default.conf # copy conf/nginx-site-ssl.conf to /etc/nginx/conf.d/default-ssl.conf # copy ssl cert files COPY conf/ssl /etc/nginx/ssl # China alpine mirror: mirrors.ustc.edu.cn ARG APKMIRROR="" # start.sh will set desired timezone with $TZ ENV TZ="Asia/Shanghai" # China php composer mirror: https://mirrors.cloud.tencent.com/composer/ ENV COMPOSERMIRROR="" # China npm mirror: https://registry.npmmirror.com ENV NPMMIRROR="" # start.sh will replace default web root from /var/www/html to $WEBROOT ENV WEBROOT="/var/www/html/public" # start.sh will use redis as session store with docker container name $PHP_REDIS_SESSION_HOST ENV PHP_REDIS_SESSION_HOST=redis # start.sh will create laravel storage folder structure if $CREATE_LARAVEL_STORAGE = 1 ENV CREATE_LARAVEL_STORAGE="1" # download required node/php packages, # some node modules need gcc/g++ to build RUN if [[ "$APKMIRROR" != "" ]]; then sed -i "s/dl-cdn.alpinelinux.org/${APKMIRROR}/g" /etc/apk/repositories ; fi\ && apk add --no-cache --virtual .build-deps gcc g++ libc-dev make \ # set preferred npm mirror && cd /usr/local \ && if [[ "$NPMMIRROR" != "" ]]; then npm config set registry ${NPMMIRROR}; fi \ && npm config set registry $NPMMIRROR \ && cd /var/www/html \ # install node modules && npm install \ # install php composer packages && if [[ "$COMPOSERMIRROR" != "" ]]; then composer config -g repos.packagist composer ${COMPOSERMIRROR}; fi \ && composer install \ # clean && apk del .build-deps \ # build js/css && npm run dev \ # set .env && cp .env.test .env \ # change /var/www/html user/group && chown -Rf nginx.nginx /var/www/html
You may check https://github.com/tangramor/nginx-php8-fpm/blob/master/start.sh for more information about what it can do.
Another example to develop with this image for a Laravel 11 project, you may modify the docker-compose.yml of your project.
Here we only modified fields image and environment under services -> laravel.test.
Make sure you have correct environment parameters set:
yaml# For more information: https://laravel.com/docs/sail services: laravel.test: image: tangramor/nginx-php8-fpm extra_hosts: - 'host.docker.internal:host-gateway' ports: - '${APP_PORT:-80}:80' - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' environment: TZ: 'Asia/Shanghai' WEBROOT: '/var/www/html/public' PHP_REDIS_SESSION_HOST: 'redis' CREATE_LARAVEL_STORAGE: '1' COMPOSERMIRROR: 'https://mirrors.cloud.tencent.com/composer/' NPMMIRROR: 'https://registry.npm.taobao.org' volumes: - '.:/var/www/html' networks: - sail depends_on: - mysql - redis - meilisearch - mailpit - selenium mysql: image: 'mysql/mysql-server:8.0' ports: - '${FORWARD_DB_PORT:-3306}:3306' environment: MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_ROOT_HOST: '%' MYSQL_DATABASE: '${DB_DATABASE}' MYSQL_USER: '${DB_USERNAME}' MYSQL_PASSWORD: '${DB_PASSWORD}' MYSQL_ALLOW_EMPTY_PASSWORD: 1 volumes: - 'sail-mysql:/var/lib/mysql' - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' networks: - sail healthcheck: test: - CMD - mysqladmin - ping - '-p${DB_PASSWORD}' retries: 3 timeout: 5s redis: image: 'redis:alpine' ports: - '${FORWARD_REDIS_PORT:-6379}:6379' volumes: - 'sail-redis:/data' networks: - sail healthcheck: test: - CMD - redis-cli - ping retries: 3 timeout: 5s meilisearch: image: 'getmeili/meilisearch:latest' ports: - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' environment: MEILI_NO_ANALYTICS: '${MEILISEARCH_NO_ANALYTICS:-false}' volumes: - 'sail-meilisearch:/meili_data' networks: - sail healthcheck: test: - CMD - wget - '--no-verbose' - '--spider' - 'http://127.0.0.1:7700/health' retries: 3 timeout: 5s mailpit: image: 'axllent/mailpit:latest' ports: - '${FORWARD_MAILPIT_PORT:-1025}:1025' - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' networks: - sail selenium: image: selenium/standalone-chromium extra_hosts: - 'host.docker.internal:host-gateway' volumes: - '/dev/shm:/dev/shm' networks: - sail networks: sail: driver: bridge volumes: sail-mysql: driver: local sail-redis: driver: local sail-meilisearch: driver: local
You may use this image as the base image to build your own. For example, to add mongodb module in images before php8.2.8_node20.5.0:
DockerfiledockerfileFROM tangramor/nginx-php8-fpm:php8.2.7_node20.3.1 RUN apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \ && apk add --no-cache --update --virtual .all-deps $PHP_MODULE_DEPS \ && pecl install mongodb \ && docker-php-ext-enable mongodb \ && rm -rf /tmp/pear \ && apk del .all-deps .phpize-deps \ && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
bashdocker build -t my-nginx-php8-fpm .
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务