Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] volume: !reset [] not applied w/ extends (services same name) #10962

Closed
bf opened this issue Sep 2, 2023 · 0 comments · Fixed by compose-spec/compose-go#455
Closed
Assignees
Labels

Comments

@bf
Copy link

bf commented Sep 2, 2023

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.

@bf bf changed the title [BUG] volume: !reset [] not applied w/ extends: when services have same name [BUG] volume: !reset [] not applied w/ extends (services have same name) Sep 2, 2023
@bf bf changed the title [BUG] volume: !reset [] not applied w/ extends (services have same name) [BUG] volume: !reset [] not applied w/ extends (services same name) Sep 2, 2023
@ndeloof ndeloof self-assigned this Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants