跳到主内容
智客 ZICQ

技能库 智客分类:运维与云 docker-basics

Docker Basics

Docker entry point — provides comprehensive guidance for Docker concepts, architecture, and basic operations. Covers what Docker is, container vs VM comparison, Docker architecture (Client-Server, daemon, registry), installation guidance for Linux/Mac/Windows, and first-container walkthrough. Includes Docker object model (Image/Container/Registry/Engine), CLI basics, and the Docker ecosystem overview. Use when the user asks about Docker basics, needs to understand Docker concepts, is new to Docker, or wants containerization fundamentals. 使用场景:Docker 入门、什么是 Docker、容器概念、Docker vs VM、Docker 安装、docker 基础命令、container basics、Docker 架构.

84 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

Docker入口——为Docker的概念,架构,和基本操作提供全面的指导. 覆盖多克是什么,容器与VM比较,多克架构(Client-Server,deamon, register),Linux/Mac/Windows的安装指导,以及第一容器走通. 包括多克对象模型(图像/容器/登记/引擎)、CLI基础和多克生态系统概览

何时用

# # # # 当 # # # # # # 跳过 # # # # # # 当 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Docker Basics — 概念与基础、When to Use、Core Concepts、Container vs VM、Docker Architecture、Quick Start。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

Docker Basics — 概念与基础When to UseCore ConceptsContainer vs VMDocker ArchitectureQuick StartVerify installationPull and run your first containerCheck it's runningDocker Object ModelInstallation PathKey CLI Groups

· 许可:Apache-2.0

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
docker-basics
description
Docker entry point — provides comprehensive guidance for Docker concepts, architecture, and basic operations. Covers what Docker is, container vs VM comparison, Docker architecture (Client-Server, daemon, registry), installation guidance for Linux/Mac/Windows, and first-container walkthrough. Includes Docker object model (Image/Container/Registry/Engine), CLI basics, and the Docker ecosystem overview. Use when the user asks about Docker basics, needs to understand Docker concepts, is new to Docker, or wants containerization fundamentals. 使用场景:Docker 入门、什么是 Docker、容器概念、Docker vs VM、Docker 安装、docker 基础命令、container basics、Docker 架构.
许可
Apache-2.0
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「docker-basics」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-7e75fd28506adaae-%E5%B1%85%E5%85%8B%E5%9F%BA%E7%A1%80.html
请存为 .cursor/skills/docker-basics/SKILL.md 或 .claude/skills/docker-basics/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/full-stack-skills/docker-skills' --list

npx skills add 'https://github.com/full-stack-skills/docker-skills' --skill 'docker-basics'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: docker-basics description: Docker entry point — provides comprehensive guidance for Docker concepts, architecture, and basic operations. Covers what Docker is, container vs VM comparison, Docker architecture (Client-Server, daemon, registry), installation guidance for Linux/Mac/Windows, and first-container walkthrough. Includes Docker object model (Image/Container/Registry/Engine), CLI basics, and the Docker ecosystem overview. Use when the user asks about Docker basics, needs to understand Docker concepts, is new to Docker, or wants containerization fundamentals. 使用场景:Docker 入门、什么是 Docker、容器概念、Docker vs VM、Docker 安装、docker 基础命令、container basics、Docker 架构. license: Apache-2.0 --- # Docker Basics — 概念与基础 Docker 生态的第一入口。从零理解 Docker 概念、架构和基础操作。 ## When to Use | ✅ Use When | ❌ Skip When | |------------|-------------| | New to Docker, learning from scratch | Already proficient with Docker | | Need to understand container vs VM | Need specific Dockerfile/CLI commands → `docker-build` / `docker-run` | | Setting up Docker for the first time | Need multi-container orchestration → `docker-compose` | | Evaluating whether to adopt Docker | Need security scanning → `docker-security` | ## Core Concepts | Concept | Definition | Analogy | |---------|-----------|---------| | **Image** | Read-only template with app + dependencies | Class definition | | **Container** | Runnable instance of an image | Object instance | | **Registry** | Repository for storing/sharing images | App Store | | **Docker Engine** | Runtime that builds and runs containers | JVM / Python interpreter | ## Container vs VM | Aspect | Container | VM | |--------|----------|-----| | **Isolation** | Process-level (share host kernel) | Hardware-level (full OS) | | **Startup** | Seconds | Minutes | | **Size** | MB | GB | | **Density** | Dozens per host | Few per host | | **Use Case** | Microservices, CI/CD, dev environments | Legacy apps, multi-OS, strong isolation | ## Docker Architecture ``` ┌─────────────────────────────┐ │ Docker CLI │ ← docker build/run/push... ├─────────────────────────────┤ │ Docker Daemon │ ← dockerd: manages images, containers, networks, volumes ├─────────────────────────────┤ │ containerd │ ← container runtime supervisor ├─────────────────────────────┤ │ runc │ ← OCI runtime (actually runs containers) └─────────────────────────────┘ │ ┌────┴────┐ ▼ ▼ Registry Host OS (Docker (Linux kernel: Hub) namespaces, cgroups) ``` ## Quick Start ```bash # Verify installation docker --version docker run hello-world # Pull and run your first container docker pull nginx:alpine docker run -d -p 8080:80 --name my-nginx nginx:alpine # Check it's running curl localhost:8080 docker ps docker stop my-nginx ``` ## Docker Object Model ``` docker run → Container (running instance of an image) docker build → Image (built from Dockerfile) docker pull → Image (downloaded from Registry) docker push → Image (uploaded to Registry) docker volume → Volume (persistent data) docker network → Network (container communication) ``` ## Installation Path | OS | Method | Notes | |----|--------|-------| | **macOS** | Docker Desktop | Includes GUI, CLI, Compose, K8s | | **Windows** | Docker Desktop + WSL2 | WSL2 backend recommended | | **Linux** | `apt/yum install docker-ce` | No GUI; add user to docker group | | **CI/Server** | Docker Engine only | Minimal footprint | ## Key CLI Groups ``` docker container → create, run, start, stop, rm, ls, inspect, logs, exec docker image → build, pull, push, tag, ls, rm, prune, inspect docker volume → create, ls, rm, prune, inspect docker network → create, ls, rm, inspect, connect, disconnect docker system → df, prune, info, events ``` ## Workflow — 推荐学习路径 Step 1: **理解概念**: 阅读 Core Concepts(Image/Container/Registry/Engine) Step 2: **安装验证**: `docker run hello-world` 确认安装成功 Step 3: **第一个容器**: `docker run -d -p 8080:80 nginx:alpine` 体验 Step 4: **进阶学习**: 掌握 docker build(写 Dockerfile)→ docker run(管理容器) Step 5: **进入生态**: 按需探索 `docker-dockerfile`/`docker-build`/`docker-compose` ## Gotchas — Common Pitfalls - **Image vs Container confusion**: `docker run` creates a NEW container each time. → **Recovery**: Use `docker start ` to restart an existing container; `docker ps -a` to see stopped containers. - **Root permission**: Linux requires `sudo` unless user is added to `docker` group (security risk: docker group = root access). → **Recovery**: `sudo usermod -aG docker $USER && newgrp docker` or use rootless Docker. - **Disk bloat**: Old images/volumes/cache accumulate fast. → **Recovery**: `docker system prune -a` monthly; check with `docker system df` first. - **Port conflict**: `-p 8080:80` means host:8080 → container:80. If host port is taken, change host side. → **Recovery**: `lsof -i :8080` to find process occupying the port, then use a different port. - **Data loss**: Without volumes, container data is ephemeral. → **Recovery**: Always use `-v volume_name:/data` for stateful data; never rely on container filesystem. ## Boundary — 能力边界(适用与不适用场景) | 分类 | 场景 | 说明 | |------|------|------| | ✅ 能做 | Docker 概念教学(Image/Container/Registry/Engine) | 从零解释核心概念 | | ✅ 能做 | 安装指导(macOS/Linux/Windows) | 提供各平台安装步骤 | | ✅ 能做 | 第一个容器实操 | `docker run hello-world` + nginx 示例 | | ⚠️ 需条件 | 深入理解容器原理 | 建议结合 Linux namespace/cgroups 文档 | | ⚠️ 需条件 | Docker Compose 多容器 | 基础概念后进入 `docker-compose` 技能 | | ❌ 超范围 | 编写 Dockerfile | 使用 `docker-dockerfile` | | ❌ 超范围 | 构建/推送镜像 | 使用 `docker-build` | | ❌ 超范围 | 生产部署/Swarm/K8s | 使用 `docker-production` | ## When NOT to Use This Skill | ❌ Skip | ✅ Use Instead | |---------|---------------| | Need to write Dockerfile | `docker-build` | | Need container management | `docker-run` | | Need multi-container apps | `docker-compose` | | Already know Docker basics | Jump to specific skill | ## Security & Stability - All examples are educational. Use official images and verified publishers in production. - Docker group membership on Linux is equivalent to root access. - No executable scripts bundled. This skill teaches concepts and basic operations. ## 📚 官方文档参考 | 文档 | 地址 | |------|------| | Docker 概述 | https://docs.docker.com/get-started/docker-overview/ | | Docker 概念 | https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-a-container/ | | 安装 Docker | https://docs.docker.com/get-started/get-docker/ | | Docker 引擎 | https://docs.docker.com/engine/ | | Docker 入门 workshop | https://docs.docker.com/get-started/workshop/ | | Docker CLI 参考 | https://docs.docker.com/reference/cli/docker/ | ## 🧭 Docker Skills Journey > 📍 **You are here: `docker-basics` — Step 1: Docker 概念与基础** ``` basics → build → run → networking/storage → compose → security/cicd → production/troubleshooting → ai-ml ``` **→ Next**: `docker-build` — Write Dockerfiles and build optimized images ## FAQ **Q1: 如何快速上手此技能?** A: 参考上方的快速开始章节,按步骤操作即可。 **Q2: 遇到版本不兼容问题怎么办?** A: 检查依赖版本,使用 lock 文件锁定,参考常见陷阱章节。 **Q3: 如何在生产环境使用?** A: 参考最佳实践章节,确保配置正确,做好监控和日志。 **Q4: 性能如何优化?** A: 参考性能优化相关文档,使用缓存、索引等手段。 **Q5: 如何贡献或反馈问题?** A: 在 GitHub 仓库提交 Issue 或 Pull Request。 **Q6: 是否支持中文?** A: 支持中文文档和中文注释,详见国内适配章节。

相关技能

运维与云

Docker Essentials

用于容器管理,图像操作,调试的基本道克命令和工作流程.

运维与云

Find Skills

从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…

运维与云

Microsoft Foundry

构建,部署,评价,优化,微调,管理微软创始代理,模型,资源最终结束. 用法:铸造、azd ai代理、azd 提供/部署、托管代理脚手架/开发/运行/部署/拖放、即时代理创建、创建代理、更新代理、添加代理工具、援引代理、代理.yaml、评估代理、批量活化、连续活化、持续监测、代理C…

运维与云

Azure Deploy

执行已有.azure/部署计划.md和基础设施文件的ALREADY-PREPARED应用程序的Azure部署。 当用户向 CREATE 请求新应用程序时, 请不要使用此技能 。 这种技能运行了 azd上行, azd 部署, trarraform 应用, 和 az 部署命令带有内置…