-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[BUG] volume: !reset [] not applied w/ extends (services same name) #10962
Copy link
Copy link
Closed
compose-spec/compose-go
#455Labels
Description
Description
There's a base docker-compose.yml which defines service app and a docker-compose.testing.yml which also defines services app and uses extends: with file: docker-compose.yml and service: app (names overlap). The docker-compose.testing.yml wants to remove the parent's volumes: section with volumes: !reset [] but it is not being removed.
Steps To Reproduce
docker-compose.yml
version: "3.8"
services:
app:
restart: always
build:
context: ./containers/
dockerfile: myservice-web.Dockerfile
target: development
volumes:
- "./containers/myservice-external-web:/home/node/app:z"
ports:
- "127.0.0.1:3000:3000/tcp"
docker-compose.testing.yml
version: "3.8"
services:
app:
extends:
file: docker-compose.yml
service: app
build:
target: production
args:
NODE_APP_PATH: "myfolder"
restart: no
volumes: !reset []
running docker-compose -f docker-compose.testing.yml config shows:
name: bug
services:
app:
build:
context: /home/myservice/containers
dockerfile: myservice-web.Dockerfile
args:
NODE_APP_PATH: myfolder
target: production
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 3000
published: "3000"
protocol: tcp
restart: "no"
volumes:
- type: bind
source: /home/myservice/containers/myservice-external-web
target: /home/node/app
bind:
selinux: z
create_host_path: true
networks:
default:
name: bug_default
It should not have the volumes section
name: bug
services:
app:
build:
context: /home/myservice/containers
dockerfile: myservice-web.Dockerfile
args:
NODE_APP_PATH: myfolder
target: production
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 3000
published: "3000"
protocol: tcp
restart: "no"
networks:
default:
name: bug_default
Compose Version
❯ docker compose version
Docker Compose version 2.20.3
❯ docker-compose version
Docker Compose version 2.20.3
Docker Environment
❯ docker info
Client:
Version: 24.0.5
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.11.2
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.20.3
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 3
Running: 1
Paused: 0
Stopped: 2
Images: 5
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
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: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 0cae528dd6cb557f7201036e9f43420650207b58.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.4.11-hardened1-1-hardened
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 62.18GiB
Name: archer
ID: c866e2d6-7ef2-41a7-b161-c66ecea0a9d7
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
It's so weird, I have found nothing which would cause this.
Please note that in both files the service is called app but there's no error from the spec if app extends app so that should not be a reason for this problem.
Reactions are currently unavailable