Install any skill in seconds. Free to start, no credit card required.
Get Started Free →yangge521/docker-deploy
Docker 容器化部署最佳实践,包含 Dockerfile 编写、多阶段构建、镜像优化和容器编排
Passed 0 of 22 test cases with the skill, and 22 of 22 without it.
0 fixed18 passed either way3 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
The instructions your model reads when the skill loads.
本技能提供 Docker 容器化部署的完整指南,涵盖 Dockerfile 编写规范、多阶段构建、镜像优化、GPU 容器配置、容器编排等核心实践。
第一阶段(builder)安装依赖,第二阶段只复制运行时文件,可减少 40-60% 镜像体积。使用 python:3.11-slim 作为基础镜像。
NVIDIA 使用 nvidia/cuda:12.1.0-runtime-ubuntu22.04 基础镜像,运行时加 --gpus all。摩尔线程使用 mthreads/musa 基础镜像。Docker Compose 中通过 deploy.resources.devices 配置 GPU。
使用 docker-compose.yml 定义多容器服务:推理服务(--gpus all)、Nginx 反向代理、Redis 缓存、SRS 流媒体。通过 volumes 挂载模型和数据,depends_on 控制启动顺序。
| 优化手段 | 效果 | 说明 |
|---|---|---|
| 多阶段构建 | 减少 40-60% | 只复制运行时文件 |
| Alpine 基础镜像 | 减少 70% | 注意 glibc 兼容性 |
| .dockerignore | 减少构建上下文 | 排除不需要的文件 |
| 合并 RUN 层 | 减少层数 | 连接多个命令 |
| --no-cache-dir | 减少缓存 | pip install 时不缓存 |
test cases passed, vs 22 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.