Skip to content

[BUG] docker-compose not attaching network given by docker-compose.override.yml #11001

@typoworx-de

Description

@typoworx-de

Description

I've been wondering that a network I've tried to attach using docker-compose.override.yml doesn't attach to my stack.

Steps To Reproduce

  1. create a simple project with docker-compose.yml and docker-compose.override.yml.
  2. set one network in docker-compose.yml
  3. try to attach another network in docker-compose.override.yml
  4. docker-compose up -d
  5. Inspect the final container and wonder why there is only network-a attached, but not network-traefik

I wound either expect docker-compose will give at least any warning for configurations that are not merged/applied (if there is any good reason for it) or to create/attach the given networks to the stack and the container asking for it.

docker-compose.yml:

version: '3.9'

networks:
  network-a:
    external: true

services:
   httpd:
     image: nginx:latest
     networks:
       network-a:

docker-compose.override.yml:

version: '3.9'

networks:
  network-traefik:
    external: true

services:
   httpd:
     image: nginx:latest
     networks:
       network-traefik:

Compose Version

Docker Compose version v2.20.0

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.11.2)
  compose: Docker Compose (Docker Inc., v2.20.0)
  scan: Docker Scan (Docker Inc., v0.8.0)
WARNING: Plugin "/usr/local/lib/docker/cli-plugins/docker-compose-v2.20.3-linux-x86_64" is not valid: plugin candidate "compose-v2.20.3-linux-x86_64" did not match "^[a-z][a-z0-9]*$"

Server:
 Containers: 31
  Running: 12
  Paused: 0
  Stopped: 19
 Images: 148
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  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: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc sysbox-runc crun
 Default Runtime: crun
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: 54ebb8ca8bf7e6ddae2eb919f5b82d1d96863dea
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.15.89-xanmod1
 Operating System: Ubuntu 16.04.7 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 62.6GiB
 Name: gabriel-XMG
 ID: PZ6V:VDD5:IKCG:L27W:Q3BS:VO7L:GVQU:TELK:LD6F:5H3W:TEYI:7UKC
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: typoworx
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  registry-api.php.docker
  registry.php.docker
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 192.168.165.0/24, Size: 24
   Base: 172.30.0.0/16, Size: 24

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions