
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
基于Debian、Alpine和Ubuntu的容器基础镜像,旨在快速构建可靠容器。该镜像提供简洁、 opinionated 的解决方案,用于构建单进程或多进程容器镜像,具有最少的层数和优化的构建过程。
它通过以下特性加速镜像开发和CI/CD流水线:
包含非root容器镜像,并支持只读容器环境。
!osixia/baseimage logo.
在 osixia-baseimage-example 目录中生成镜像模板
bashmkdir osixia-baseimage-example
bash# Debian docker run --rm --user $UID --volume $(pwd)/osixia-baseimage-example:/run/container/generator \ osixia/baseimage generate bootstrap
bash# Alpine docker run --rm --user $UID --volume $(pwd)/osixia-baseimage-example:/run/container/generator \ osixia/baseimage:alpine generate bootstrap
bash# Ubuntu docker run --rm --user $UID --volume $(pwd)/osixia-baseimage-example:/run/container/generator \ osixia/baseimage:ubuntu generate bootstrap
注意:添加 --multi-process 可获取多进程镜像示例。
列出 osixia-baseimage-example 目录中生成的文件和目录
bashtree -a osixia-baseimage-example
bashosixia-baseimage-example ├── Dockerfile ├── environment │ ├── .env │ └── README.md └── services └── service-1 ├── finish.sh ├── install.sh ├── .priority ├── process.sh ├── README.md └── startup.sh
查看Dockerfile内容
DockerfileFROM osixia/baseimage ARG IMAGE="osixia/baseimage-example:latest" ENV CONTAINER_IMAGE=${IMAGE} # 下载服务所需的包或资源 # RUN container packages install --update --clean \ # [...] # && curl -o resources.tar.gz https://[...].tar.gz \ # && tar -xzf resources.tar.gz \ # && rm resources.tar.gz COPY services /container/services # 安装并将服务链接到入口点 RUN container services install \ && container services link COPY environment /container/environment
使用 osixia-baseimage-example 目录中的文件构建镜像 example/my-image:develop
bashdocker build --tag example/my-image:develop --build-arg IMAGE=example/my-image:develop ./osixia-baseimage-example
注意:--build-arg IMAGE=example/my-image:develop 用于在容器内设置镜像名称。
运行 example/my-image:develop 镜像
bashdocker run example/my-image:develop
log2026-02-26T11:30:59+01:00 INFO Container image: example/my-image:develop 2026-02-26T11:30:59+01:00 INFO Loading environment variables from /container/environment/.env ... 2026-02-26T11:30:59+01:00 INFO Running /container/services/service-1/startup.sh ... service-1: Doing some container start setup ... service-1: EXAMPLE_ENV_VAR=Hello :) ... 2026-02-26T11:30:59+01:00 INFO Running /container/services/service-1/process.sh ... service-1: Just going to sleep for 10 seconds ... 2026-02-26T11:31:09+01:00 INFO Running /container/services/service-1/finish.sh ... service-1: process ended ... 2026-02-26T11:31:09+01:00 INFO Exiting ...
至此,您已拥有基于osixia/baseimage的单进程镜像。关于environment和service目录中文件的结构、用途和使用方法的详细文档,请参见各自的README.md文件。
bashdocker run --rm osixia/baseimage --help
/ _ \ ___(_)_ _(_) __ _ / / __ ) __ _ ___ ___(_)_ __ ___ __ _ __ _ ___ | | | / __| \ \/ / |/ _` | / /| _ \ / _` / __|/ _ \ | '_ ` _ \ / _` |/ _` |/ _ | |_| \__ \ |> <| | (_| |/ / | |_) | (_| \__ \ __/ | | | | | | (_| | (_| | __/ \___/|___/_/_/\_\_|\__,_/_/ |____/ \__,_|___/\___|_|_| |_| |_|\__,_|\__, |\___| |___/ Container image built with osixia/baseimage (develop) 🐳✨🌴 https://github.com/osixia/container-baseimage Usage: container entrypoint [flags] container entrypoint [command] Aliases: entrypoint, ep Available Commands: generate 生成示例模板 Flags: -e, --skip-env-files 跳过从环境文件加载环境变量 -s, --skip-startup 跳过运行启动前命令和启动脚本 -p, --skip-process 跳过运行进程前命令和进程脚本 -f, --skip-finish 跳过运行结束前命令和结束脚本 --step string 仅运行一个生命周期步骤及其前置命令和脚本,选项: startup, process, finish --pre-startup-cmd stringArray 在启动脚本前运行命令 --pre-process-cmd stringArray 在进程脚本前运行命令 --pre-finish-cmd stringArray 在结束脚本前运行命令 --pre-exit-cmd stringArray 在容器退出前运行命令 -x, --exec stringArray 仅执行列出的服务(默认:运行链接到入口点的服务) -X, --skip stringArray 跳过列出的服务 --skip-all 跳过所有服务 -b, --bash 与其他服务或命令一起运行Bash -k, --kill-all-on-exit 退出时终止所有剩余容器进程(发送SIGTERM)(默认true) -t, --kill-all-on-exit-timeout duration 超时后强制终止所有进程(SIGTERM超时后发送SIGKILL)(默认15s) -r, --restart 自动重启失败的进程(单进程:默认false,多进程:默认true) -a, --keep-alive 所有进程退出后保持容器运行 -w, --unsafe-fast-write 使用eatmydata禁用fsync和相关同步操作 -d, --debug 设置日志级别为debug,安装调试包并运行Bash -i, --install-packages strings 安装包 -v, --version 打印容器镜像版本 -l, --log-level string 设置日志级别,选项: error, warning, info, debug, trace(默认"info") --quiet 仅显示错误 -o, --log-format string 设置日志格式,选项: console, json(默认"console") -h, --help entrypoint帮助
查看完整文档和功能列表,请访问 osixia/baseimage 文档。
浏览源代码并为该项目贡献,请访问 https://github.com/osixia/container-baseimage%E3%80%82
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务