docker-helper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDocker-helper
Docker-helper
Instructions
操作指南
When helping with Docker tasks:
- Check running containers: docker ps -a
- View logs: docker logs -f <container>
- Inspect container: docker inspect <container>
- Execute commands: docker exec -it <container> /bin/bash
- Use multi-stage builds to reduce image size
- Order Dockerfile commands by frequency of change
- Use .dockerignore to exclude unnecessary files
- Avoid running as root; create non-privileged users
- Use health checks in docker-compose
- Networking: Check bridge networks and port mappings
- Volumes: Verify volume mounts and permissions
- Build cache: Use --no-cache when needed
- Resource limits: Set memory/CPU limits appropriately
- Use version 3+ syntax
- Leverage environment files (.env)
- Use depends_on with health checks
- Implement restart policies
在处理Docker相关任务时:
- 查看运行中的容器:docker ps -a
- 查看日志:docker logs -f <container>
- 检查容器详情:docker inspect <container>
- 执行命令:docker exec -it <container> /bin/bash
- 使用多阶段构建来减小镜像体积
- 按命令变更频率排序Dockerfile中的指令
- 使用.dockerignore排除不必要的文件
- 避免以root用户运行;创建非特权用户
- 在docker-compose中使用健康检查
- 网络配置:检查桥接网络和端口映射
- 卷管理:验证卷挂载和权限设置
- 构建缓存:必要时使用--no-cache参数
- 资源限制:合理设置内存/CPU限制
- 使用3+版本的语法
- 利用环境文件(.env)
- 结合健康检查使用depends_on
- 配置重启策略
Examples
示例
Add examples of how to use this skill here.
在此处添加使用该技能的示例。
Notes
注意事项
- This skill was auto-generated
- Edit this file to customize behavior
- 本技能为自动生成
- 编辑此文件可自定义其行为