跳到主内容
智客 ZICQ

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

Tailscale Docker Debug

诊断出多克容器内有尾端级连接和DNS故障. 检测出用户空间对内核模式,DNS解析器冲突,TUN接口问题,以及多尾网不匹配. 使用被 IP 连接到 Tailscale 的同平端, 但 MagicDNS 名称失败, 或者当容器意外地回到用户空间网络时使用 。 当客户在多克或波德曼部署Tailscale并报告DNS不工作时,或者当从多克跑向多克作曲打破了TUN功能时,也会使用.

87 安装量

官方网址:skills.sh

技能介绍

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

做什么

诊断出多克容器内有尾端级连接和DNS故障. 检测用户空间对内核模式、 DNS 解析器冲突、 TUN 接口问题和多尾网不匹配

何时用

通过 IP 但 MagicDNS 名称失败, 或当容器出乎意料地回到用户空间网络时, 当客户在 Docker 或 Podman 部署 Tailscale 并报告 DNS 无效时, 或者当从 Docker 迁移到 Docker 时

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Tailscale Docker Debug、What this skill does、Common triggers、Diagnostic workflow、Step 1 — Detect container runtime mode、Step 2 — Verify TUN interface exists。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/compose-configuration-matrix.md、references/dns-resolver-chain.md、references/common-failures.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Diagnose Tailscale connectivity and DNS failures inside Docker containers. Detects userspace vs kernel mode, DNS resolver conflicts, TUN interface issues, and multi-tailnet mismatches. Use when Tailscale peers connect by IP but MagicDNS names fail, or when containers fall back to userspace networking unexpectedly. Also use when a customer deploys Tailscale in Docker or Podman and reports DNS not working, or when migrating from docker run to docker compose breaks TUN functionality.

Tailscale Docker DebugWhat this skill doesCommon triggersDiagnostic workflowStep 1 — Detect container runtime modeStep 2 — Verify TUN interface existsStep 3 — Check DNS resolver chainStep 4 — Verify 100.100.100.100 routingStep 5 — Detect multi-tailnet conflictStep 6 — Verify MagicDNS end-to-endError handlingReferences

兼容:Requires Docker or Podman CLI. Container must run the tailscale/tailscale image or have Tailscale installed.

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
tailscale-docker-debug
description
Diagnose Tailscale connectivity and DNS failures inside Docker containers. Detects userspace vs kernel mode, DNS resolver conflicts, TUN interface issues, and multi-tailnet mismatches. Use when Tailscale peers connect by IP but MagicDNS names fail, or when containers fall back to userspace networking unexpectedly. Also use when a customer deploys Tailscale in Docker or Podman and reports DNS not working, or when migrating from docker run to docker compose breaks TUN functionality.
compatibility
Requires Docker or Podman CLI. Container must run the tailscale/tailscale image or have Tailscale installed.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 3
  • references/compose-configuration-matrix.md
  • references/dns-resolver-chain.md
  • references/common-failures.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

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

安装这个技能

Skills CLI ↗

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

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

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

把 Agent Skill「tailscale-docker-debug」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-766a3ce5b33830ff-%E5%B0%BE%E7%AB%AF%E8%B0%83%E8%AF%95%E5%99%A8.html
请存为 .cursor/skills/tailscale-docker-debug/SKILL.md 或 .claude/skills/tailscale-docker-debug/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/rshade/agent-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

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

npx skills add 'https://github.com/rshade/agent-skills' --list

npx skills add 'https://github.com/rshade/agent-skills' --skill 'tailscale-docker-debug'

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

阅读排版
--- name: tailscale-docker-debug description: > Diagnose Tailscale connectivity and DNS failures inside Docker containers. Detects userspace vs kernel mode, DNS resolver conflicts, TUN interface issues, and multi-tailnet mismatches. Use when Tailscale peers connect by IP but MagicDNS names fail, or when containers fall back to userspace networking unexpectedly. Also use when a customer deploys Tailscale in Docker or Podman and reports DNS not working, or when migrating from docker run to docker compose breaks TUN functionality. compatibility: > Requires Docker or Podman CLI. Container must run the tailscale/tailscale image or have Tailscale installed. --- # Tailscale Docker Debug Diagnose and fix Tailscale connectivity and DNS issues inside Docker containers. Runs six sequential checks covering the full debugging chain from container runtime mode through MagicDNS resolution. ## What this skill does 1. Detects whether the container runs in kernel or userspace mode. 2. Verifies the TUN interface exists with a Tailscale IP. 3. Checks the DNS resolver chain for misrouted queries. 4. Confirms 100.100.100.100 routes through the container's Tailscale. 5. Detects multi-tailnet conflicts between host and container. 6. Validates MagicDNS end-to-end with a name resolution test. ## Common triggers - Customer reports "DNS doesn't work" inside Docker/Podman containers - Host on one tailnet, containers on a different tailnet - Compose file has `NET_ADMIN` and `/dev/net/tun` but Tailscale still runs in userspace mode - Migration from `docker run` to `docker compose` breaks TUN ## Diagnostic workflow Run each step in order. Stop at the first failure and apply the fix before continuing — later steps depend on earlier ones. ### Step 1 — Detect container runtime mode ```bash docker logs 2>&1 | grep -iE "tun|userspace|netstack" ``` **Pass:** Logs show `tun "tailscale0"` — kernel mode. Proceed to step 2. **Fail:** Logs show `--tun=userspace-networking`. The official `tailscale/tailscale` image defaults to userspace via containerboot regardless of capabilities. **Fix:** Set `TS_USERSPACE=false` in environment. Use `devices:` (not `volumes:`) for `/dev/net/tun`. Add `cap_add: [NET_ADMIN, SYS_MODULE]`. See `references/compose-configuration-matrix.md` for the full config. ### Step 2 — Verify TUN interface exists ```bash docker exec ip addr show tailscale0 ``` **Pass:** Interface shows a `100.x.y.z/32` address. Proceed to step 3. **Fail:** No `tailscale0` interface even with `TS_USERSPACE=false`. **Fix:** Change `/dev/net/tun` from `volumes:` to `devices:` in compose. Verify the device exists in the container with major/minor `10, 200`. Confirm `cap_add: [NET_ADMIN, SYS_MODULE]`. ### Step 3 — Check DNS resolver chain ```bash docker exec cat /etc/resolv.conf ``` Examine three things: - `nameserver` — expect `127.0.0.11` (Docker embedded DNS) - External servers — should forward to `100.100.100.100` - `search` — should match the container's tailnet, not the host's **Fail indicators:** - `ExtServers: [host(127.0.0.53)]` — Docker forwards to host systemd-resolved instead of Tailscale - Search domain belongs to a different tailnet **Fix:** Add `dns: [100.100.100.100]` to each service in compose. See `references/dns-resolver-chain.md` for the full resolution path. ### Step 4 — Verify 100.100.100.100 routing ```bash docker exec ip route get 100.100.100.100 ``` **Pass:** Routes via `tailscale0` or a local interface. **Fail:** Routes via `eth0` or Docker gateway (e.g., `via 172.18.0.1`) — DNS queries escape to the host. ```bash docker exec ss -ulnp | grep 100.100 ``` **Fix:** This is a symptom of step 1 (userspace mode) or step 2 (missing TUN). Fix those first. ### Step 5 — Detect multi-tailnet conflict ```bash docker exec tailscale status | head -1 docker exec grep search /etc/resolv.conf ``` Compare the tailnet shown in `tailscale status` against the search domain in resolv.conf. **Fail:** Search domain (inherited from host) doesn't match the container's tailnet. Example: host on `tucuxi-lungfish.ts.net`, container on `tail9a660c.ts.net`. **Fix:** Add `dns_search: [.ts.net]` in compose, or use FQDNs exclusively. Root cause is Docker inheriting the host's resolv.conf search domain. ### Step 6 — Verify MagicDNS end-to-end ```bash docker exec tailscale dns status | head -3 ``` **Pass:** Shows `Tailscale DNS: enabled`. **Fail:** Shows `Tailscale DNS: disabled`. **Fix:** Set `TS_ACCEPT_DNS=true` in environment. **Final validation:** ```bash docker exec nslookup ..ts.net 100.100.100.100 docker exec ping -c 1 ..ts.net ``` If both succeed, MagicDNS is working correctly inside the container. ## Error handling Do not silently skip a failed check. Report the specific failure with the fix before continuing. If a fix requires restarting the container, instruct the user to recreate it (`docker compose up -d`) and rerun the workflow from step 1. The log message `getting OS base config is not supported` is non-fatal — Tailscale cannot read the container's DNS config directly. Fix DNS via the compose file instead. ## References - `references/compose-configuration-matrix.md` — minimum compose config for kernel-mode Tailscale with MagicDNS, setting-by-setting breakdown - `references/dns-resolver-chain.md` — full DNS resolution path through Docker embedded DNS, short name vs FQDN conflict - `references/common-failures.md` — symptom-based lookup table with root causes and fixes

相关技能

运维与云

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 部署命令带有内置…