docker-networking

Configure Docker networking for containers including bridge, overlay, and service discovery

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "docker-networking" with this command: npx skills add pluginagentmarketplace/custom-plugin-docker/pluginagentmarketplace-custom-plugin-docker-docker-networking

Docker Networking Skill

Master Docker networking concepts and configuration for container communication, service discovery, and network isolation.

Purpose

Configure and troubleshoot Docker networks for development and production environments with proper isolation and service discovery.

Parameters

ParameterTypeRequiredDefaultDescription
driverenumNobridgebridge/overlay/host/macvlan
subnetstringNo-Custom subnet CIDR
internalbooleanNofalseInternal-only network

Network Drivers

DriverUse CaseMulti-HostEncryption
bridgeSingle host, defaultNoNo
overlaySwarm, multi-hostYesOptional
hostMax performanceNoN/A
macvlanPhysical networkNoNo
noneDisable networkingNoN/A

Configuration Examples

Custom Bridge Network

# Create network with custom subnet
docker network create \
  --driver bridge \
  --subnet 172.28.0.0/16 \
  --gateway 172.28.0.1 \
  my_network

# Run container on network
docker run -d --name app \
  --network my_network \
  nginx:alpine

Docker Compose Networking

services:
  frontend:
    image: nginx:alpine
    networks:
      - public
    ports:
      - "80:80"

  backend:
    image: node:20-alpine
    networks:
      - public
      - private
    expose:
      - "3000"

  database:
    image: postgres:16-alpine
    networks:
      - private  # Internal only

networks:
  public:
    driver: bridge
  private:
    driver: bridge
    internal: true  # No external access

Service Discovery

# Containers can reach each other by service name
services:
  app:
    image: myapp
    environment:
      # Use service name as hostname
      DATABASE_HOST: database
      CACHE_HOST: redis

  database:
    image: postgres:16-alpine

  redis:
    image: redis:alpine

Overlay Network (Swarm)

# Create encrypted overlay
docker network create \
  --driver overlay \
  --attachable \
  --opt encrypted \
  my_overlay

Port Mapping

# Map host:container
docker run -p 8080:80 nginx

# Bind to specific interface
docker run -p 127.0.0.1:8080:80 nginx

# Random host port
docker run -P nginx

# UDP port
docker run -p 53:53/udp dnsserver

Error Handling

Common Errors

ErrorCauseSolution
network not foundTypo or deletedCreate network
address in usePort conflictChange port
cannot reachWrong networkCheck network membership
DNS failedService not readyAdd health checks

Fallback Strategy

  1. Verify network exists: docker network ls
  2. Check container membership: docker network inspect <net>
  3. Test DNS: docker exec app nslookup backend

Troubleshooting

Debug Checklist

  • Network created? docker network ls
  • Container connected? docker inspect <container>
  • DNS resolving? nslookup from container
  • Port mapped? docker port <container>

Diagnostic Commands

# List networks
docker network ls

# Inspect network
docker network inspect my_network

# Test connectivity
docker exec app ping -c 3 database

# Check DNS
docker exec app nslookup backend

# View port mappings
docker port container_name

Network Debugging

# Enter container network namespace
docker exec -it app sh

# Check DNS resolution
cat /etc/resolv.conf
nslookup database

# Check connectivity
ping -c 3 backend
curl http://backend:3000/health

Usage

Skill("docker-networking")

Related Skills

  • docker-compose-setup
  • docker-swarm

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

docker-compose-setup

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

docker-optimization

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

docker-swarm

No summary provided by upstream source.

Repository SourceNeeds Review