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] Docker compose does not ignore extension fields under long form depends_on #11930

Closed
LelouBil opened this issue Jun 22, 2024 · 1 comment · Fixed by compose-spec/compose-go#659
Assignees
Labels

Comments

@LelouBil
Copy link

LelouBil commented Jun 22, 2024

Description

When adding an extension field (starting with x-) under a depends_on long form element, compose gives an "Additional property is not allowed" error, whereas everywhere else it ignores it (as specified in the documentation and reference)

https://docs.docker.com/compose/compose-file/11-extension

Compose ignores any fields that start with x-, this is the sole exception where Compose silently ignores unrecognized fields.
They also can be used within any structure in a Compose file where user-defined keys are not expected.

Steps To Reproduce

  1. Have a working docker-compose
  2. Use this example docker-compose.yaml file
x-ignored: test

services:
  nginx:
    image: nginx:latest
    x-other-ignore: true
    depends_on:
      other_nginx:
        condition: service_started
        x-not-ignored: bug
  other_nginx:
    image: nginx:latest
  1. docker compose up
  2. validating /tmp/test/docker-compose.yml: services.nginx.depends_on.other_nginx Additional property x-not-ignored is not allowed

Compose Version

Docker Compose version v2.27.0

Docker Environment

Client: Docker Engine - Community
 Version:    26.1.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 18
  Running: 16
  Paused: 0
  Stopped: 2
 Images: 67
 Server Version: 26.1.2
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: loki
 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 splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e377cd56a71523140ca6ae87e30244719194a521
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-21-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.749GiB
 Name: staging
 ID: ea0d18d1-a91d-4022-8065-ad7026d0083c
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 174
  Goroutines: 172
  System Time: 2024-06-22T15:13:54.57807414+02:00
  EventsListeners: 0
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

Maybe I should file it with https://github.com/compose-spec/compose-go ?
I see their https://github.com/compose-spec/compose-go/blob/main/schema/compose-spec.json doesn't have a key "patternProperties": {"^x-": {}} for the long form depends_on whereas it is present for most of the other objects in the file

@jhrotko
Copy link
Contributor

jhrotko commented Jul 9, 2024

@idsulik The source of truth of compose-spec is in compose-go (I know, it's counter intuitive). I added a PR for it. Thanks for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants