Skip to content

Cannot attach external overlay network to container on swarm worker node #8996

@ciffelia

Description

@ciffelia

Description

I cannot attach an overlay network created in a swarm master node to a container defined in my docker-compose.yml on a swarm worker node.

I think #4601, which seems to be solved in v1.23.0, happened again in compose v2.

Steps to reproduce the issue:

  1. Setup swarm with two nodes (one master and one worker).
    1. On machine A (master), run docker swarm init --advertise-addr <IP address of machine A> and copy the join command
    2. On machine B (worker), run the join command
  2. On master node, run docker network create --driver overlay --attachable example_overlay_network
  3. On worker node, create docker-compose.yml with the following content and run docker compose up
services:
  app:
    image: alpine
    networks:
      - example_overlay_network

networks:
  example_overlay_network:
    external: true
    driver: overlay

Describe the results you received:

docker compose up failed with the following error.

network example_overlay_network declared as external, but could not be found

Describe the results you expected:

The app container is created and attached to example_overlay_network network.

Additional information you deem important (e.g. issue happens only occasionally):

N/A

Output of docker compose version:

master node:

Docker Compose version v2.1.1

worker node:

Docker Compose version v2.1.1

Output of docker info:

master node:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  compose: Docker Compose (Docker Inc., v2.1.1)

Server:
 Containers: REDACTED
  Running: REDACTED
  Paused: REDACTED
  Stopped: REDACTED
 Images: REDACTED
 Server Version: 20.10.11
 Storage Driver: btrfs
  Build Version: Btrfs v5.15
  Library Version: 102
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: REDACTED
  Is Manager: true
  ClusterID: REDACTED
  Managers: 1
  Nodes: 4
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: REDACTED
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: REDACTED
  Manager Addresses:
   REDACTED:REDACTED
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1e5ef943eb76627a6d3b6de8cd1ef6537f393a71.m
 runc version: v1.0.2-0-g52b36a2d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.83-1-lts
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 974.3MiB
 Name: REDACTED
 ID: REDACTED
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

worker node:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
  compose: Docker Compose (Docker Inc., v2.1.1)
  scan: Docker Scan (Docker Inc., v0.9.0)

Server:
 Containers: REDACTED
  Running: REDACTED
  Paused: REDACTED
  Stopped: REDACTED
 Images: REDACTED
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: local
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: REDACTED
  Is Manager: false
  Node Address: REDACTED
  Manager Addresses:
   REDACTED:REDACTED
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.11.0-1022-oracle
 Operating System: Ubuntu 20.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 972.1MiB
 Name: REDACTED
 ID: REDACTED
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions