Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
openaec-foundation avatar

Docker Errors Networking

  • 9 installs
  • 9 repo stars
  • Updated July 8, 2026
  • openaec-foundation/docker-claude-skill-package

Helps with devops & ci/cd tasks.

About

docker-errors-networking is a Claude Code skill for devops & ci/cd. It helps solo builders move faster with AI-assisted development.

  • docker-errors-networking
  • DevOps & CI/CD
  • AI-coding skill

Docker Errors Networking by the numbers

  • 9 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,020 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/openaec-foundation/docker-claude-skill-package --skill docker-errors-networking

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs9
repo stars9
Last updatedJuly 8, 2026
Repositoryopenaec-foundation/docker-claude-skill-package

What it does

Helps with devops & ci/cd tasks.

Files

SKILL.mdMarkdownGitHub ↗

docker-errors-networking

Quick Reference

Rule #1: ALWAYS Use User-Defined Networks

NEVER use the default bridge network. It lacks DNS resolution, proper isolation, and configuration flexibility. ALWAYS create a user-defined bridge network:

docker network create mynet
docker run --network mynet --name web nginx
docker run --network mynet --name api node
# api can reach web via hostname "web" — automatic DNS

Network Debugging Flowchart

Container cannot communicate
        |
        v
[Are containers on the SAME network?]
  |                    |
  NO                   YES
  |                    |
  v                    v
docker network     [Can they ping by IP?]
connect mynet        |              |
container            NO             YES
  |                  |              |
  v                  v              v
Retry            [Check firewall/  [DNS issue — check
                  iptables]        container name and
                  See §Firewall    /etc/resolv.conf]
                                   See §DNS
        |
        v
[Can container reach internet?]
  |              |
  NO             YES
  |              |
  v              v
Check ip_forward Port mapping issue
and DNS config   See §Port Mapping
See §No Internet

---

Diagnostic Table: Symptom > Cause > Fix

DNS Resolution Failures

SymptomCauseFix
dial tcp: lookup <hostname>: no such hostContainers on default bridge (no DNS)ALWAYS use user-defined network: docker network create mynet
dial tcp: lookup <hostname>: no such host on custom networkTarget container name misspelled or not runningVerify: docker ps --filter network=mynet. Use exact container name or network alias
DNS works by container name but not by service nameUsing docker run instead of ComposeUse --network-alias for custom aliases: docker run --network mynet --network-alias db postgres
Could not resolve host for external domainsContainer DNS misconfiguredCheck: docker exec <ctr> cat /etc/resolv.conf. Fix: docker run --dns 8.8.8.8 or set in daemon.json
WARNING: Local (127.0.0.1) DNS resolver found in resolv.confHost uses loopback DNS (systemd-resolved/dnsmasq)Set DNS in /etc/docker/daemon.json: {"dns": ["8.8.8.8", "8.8.4.4"]} and restart Docker

Connection Refused

SymptomCauseFix
connection refused between containers on same networkTarget service not listening on 0.0.0.0NEVER bind to 127.0.0.1 inside container. ALWAYS bind to 0.0.0.0
connection refused from host to containerPort not published or wrong portVerify: docker port <ctr>. Publish: docker run -p 8080:80
connection refused — service starting slowlyContainer healthy but service not readyAdd health check with --health-cmd. Use depends_on with condition: service_healthy in Compose
connection refused after container restartIP address changedNEVER hardcode container IPs. ALWAYS use container names or network aliases for DNS

Port Mapping Issues

SymptomCauseFix
port is already allocated / bind: address already in useHost port in use by another processFind: lsof -i :PORT or `ss -tlnp \
Published port not accessible from outside hostBinding to localhost onlyChange -p 127.0.0.1:8080:80 to -p 8080:80 to bind all interfaces
Port published but no responseContainer process crashed or not listeningCheck: docker logs <ctr> and docker exec <ctr> ss -tlnp
-P maps to unexpected portsEXPOSE in Dockerfile not matching actual service portALWAYS use explicit -p host:container instead of -P in production

Default Bridge Limitations

SymptomCauseFix
Containers cannot reach each other by nameDefault bridge lacks embedded DNSMigrate to user-defined bridge: docker network create mynet
All containers see each other (no isolation)Default bridge connects all unspecified containersUse separate user-defined networks per application stack
Cannot connect/disconnect without restartDefault bridge does not support live operationsUser-defined bridges support: docker network connect/disconnect

No Internet from Container

SymptomCauseFix
ping: bad address or no route to hostIP forwarding disabled on hostEnable: sysctl -w net.ipv4.ip_forward=1. Persist in /etc/sysctl.conf
DNS works but HTTP times outFirewall blocking outbound trafficCheck iptables FORWARD chain. Docker needs ACCEPT for its bridge subnets
--network host works but bridge does notNAT/masquerade not workingVerify: iptables -t nat -L POSTROUTING. Restart Docker to rebuild rules
No connectivity after Docker upgradeiptables rules lostsudo systemctl restart docker to regenerate network rules

Firewall and iptables Conflicts

SymptomCauseFix
driver failed programming external connectivityiptables conflict or stale rulesRestart Docker: sudo systemctl restart docker. Check iptables rules
Firewalld/ufw blocking Docker trafficHost firewall overriding Docker iptablesFor ufw: allow Docker subnet. For firewalld: add Docker zone. Or set "iptables": true in daemon.json
docker0 bridge disappearsNetworkManager or systemd-networkd managing Docker interfacesMark docker0 as unmanaged in NetworkManager or systemd-networkd config
Containers lose connectivity after firewall reloadFirewall flush removed Docker chainsALWAYS restart Docker after firewall changes: sudo systemctl restart docker

Overlay Network Issues

SymptomCauseFix
Cannot create overlay networkSwarm mode not initializedInitialize: docker swarm init or join an existing swarm
Standalone containers cannot join overlayNetwork not attachableCreate with --attachable: docker network create -d overlay --attachable mynet
Cross-host communication failsRequired ports blocked between hostsOpen: 2377/tcp (control), 4789/udp (VXLAN), 7946/tcp+udp (node discovery)
Encrypted overlay fails on WindowsWindows limitationEncrypted overlay is NOT supported on Windows. Use unencrypted or different approach

Subnet Conflicts

SymptomCauseFix
Containers cannot reach host network resourcesDocker subnet overlaps with host/VPN networkSpecify non-conflicting subnet: docker network create --subnet=10.99.0.0/16 mynet
VPN breaks after Docker installDocker default pools conflict with VPN rangesConfigure in /etc/docker/daemon.json: {"default-address-pools": [{"base": "10.99.0.0/16", "size": 24}]}
network X has active endpoints when removingContainers still connectedDisconnect all: docker network disconnect -f mynet <ctr> then remove

---

Network Debugging Commands

Essential Diagnostic Commands

# Check which network a container is on
docker inspect --format='{{range $k, $v := .NetworkSettings.Networks}}{{$k}} {{end}}' <ctr>

# Get container IP address
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <ctr>

# List all containers on a network
docker network inspect --format='{{range .Containers}}{{.Name}} {{end}}' mynet

# Check DNS resolution inside container
docker exec <ctr> nslookup <target-hostname>
docker exec <ctr> cat /etc/resolv.conf

# Test connectivity between containers
docker exec <ctr> ping -c 2 <target-hostname>
docker exec <ctr> wget -qO- http://<target-hostname>:<port>/

# Check listening ports inside container
docker exec <ctr> ss -tlnp
docker exec <ctr> netstat -tlnp

# Check published port mapping
docker port <ctr>

# Inspect full network configuration
docker network inspect mynet

# Check iptables rules (host)
sudo iptables -L -n -v
sudo iptables -t nat -L -n -v

# Check IP forwarding (host)
sysctl net.ipv4.ip_forward

Compose-Specific Debugging

# Check default network created by Compose
docker network ls --filter "label=com.docker.compose.project=<project>"

# Verify service DNS names
docker compose exec <service> nslookup <other-service>

# Check Compose network config
docker compose config | grep -A 10 networks

---

Compose Networking Patterns

Correct: Services on Shared Network

# docker-compose.yml
services:
  web:
    image: nginx
    ports:
      - "8080:80"  # Only needed for external access
    networks:
      - app-net

  api:
    image: node:20-alpine
    networks:
      - app-net  # Can reach "web" by hostname

networks:
  app-net:
    driver: bridge

Correct: Isolated Backend Network

services:
  web:
    networks:
      - frontend
      - backend

  api:
    networks:
      - backend

  db:
    networks:
      - backend  # Not accessible from frontend

networks:
  frontend:
  backend:
    internal: true  # No external internet access

Anti-Pattern: Missing Network Declaration

# NEVER rely on the default Compose network for multi-project setups
# ALWAYS declare explicit networks when services need cross-project communication
services:
  api:
    networks:
      - shared-net

networks:
  shared-net:
    external: true  # Must exist before compose up

---

Critical Rules

ALWAYS use user-defined bridge networks -- the default bridge lacks DNS, isolation, and live connect/disconnect.

ALWAYS bind services to 0.0.0.0 inside containers -- binding to 127.0.0.1 makes the service unreachable from other containers.

ALWAYS restart Docker after firewall changes -- firewall reloads flush Docker's iptables chains.

NEVER hardcode container IP addresses -- IPs change on restart. Use DNS names or network aliases.

NEVER use --link -- it is legacy and deprecated. Use user-defined networks with DNS.

NEVER expose ports with -p for container-to-container communication -- containers on the same network can reach all ports directly.

---

Reference Links

  • references/diagnostics.md -- Complete error-to-cause-to-solution lookup table
  • references/examples.md -- Network debugging sessions with step-by-step resolution
  • references/anti-patterns.md -- Networking configuration mistakes and why they fail

Official Sources

  • https://docs.docker.com/engine/network/
  • https://docs.docker.com/engine/network/drivers/bridge/
  • https://docs.docker.com/engine/network/drivers/overlay/
  • https://docs.docker.com/engine/daemon/troubleshoot/

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.