Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

docker compose config is lacking/removing version property #1824

Closed
slinstaedt opened this issue Jun 21, 2021 · 5 comments
Closed

docker compose config is lacking/removing version property #1824

slinstaedt opened this issue Jun 21, 2021 · 5 comments
Labels
wontfix 🚫 This will not be worked on

Comments

@slinstaedt
Copy link

slinstaedt commented Jun 21, 2021

Description

When rendering configurable compose files for docker stack deploy, we are using docker-compose config using multiple -f compose input files and environment placeholder. Unfortunately the output of docker compose config is lacking the docker compose file version property, which is of course part of the input files. docker stack deploy is not able to deploy, because it falls back to version 1.0 and returning a unsupported Compose file version: 1.0.

Reproduce

Just run docker compose config on any valid compose file with a version property.
Describe the results you received:
Output is lacking the version property.

Describe the results you expected:
Output is containing the version property with the value of the input compose file.

Given

❯ docker context show
default
❯ docker version
Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:22 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
❯ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0-beta.3)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 24
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 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: p11tnytx3rtusfy87m7d04en8
  Is Manager: true
  ClusterID: ocjp2ivn19kz1peaud4ayyhum
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  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: 192.168.65.6
  Manager Addresses:
   192.168.65.6:2377
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.25-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.941GiB
 Name: docker-desktop
 ID: A3HB:NDQJ:6GXM:USIP:AVBW:Q3TD:M2LD:NLYW:K2AG:XWR7:A2DO:ZJPQ
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 54
  Goroutines: 157
  System Time: 2021-06-21T09:02:12.043742019Z
  EventsListeners: 3
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
@ndeloof
Copy link
Collaborator

ndeloof commented Jun 21, 2021

docker stack does not implement the Compose Specification, so this issue with the legacy version attribute. See docker/cli#2527

Please note you can use multiple compose files as inputs to docker stack deploy and don't have to use compose config for this purpose.

@ndeloof ndeloof closed this as completed Jun 21, 2021
@ndeloof ndeloof added the wontfix 🚫 This will not be worked on label Jun 21, 2021
@tejksat
Copy link

tejksat commented Jul 20, 2021

docker stack does not implement the Compose Specification, so this issue with the legacy version attribute. See docker/cli#2527

docker compose now begins to replace docker-compose command on Docker for Mac and Docker for Windows (transparently for user by enabling Use Docker Compose V2 experimental feature). Compose configuration files are still used now not only within docker stack commands thus version seems to be the the valuable attribute. @ndeloof could you please comment more on that?

I am asking because in PyCharm integration for docker-compose we utilize docker-compose config command (f.e. to interpolate substitutions in the Compose configuration and apply override files). The behavior of docker-compose config has suddenly changed and this has affected the existing releases of PyCharm (and other IDEs with the similar feature).

@ndeloof
Copy link
Collaborator

ndeloof commented Jul 20, 2021

IIUC PyCharm run external process to interpolate compose file, then parse it. Then you probably want your parser code to be updated so it embrace the compose specification. Typically, you should consider support for profiles.

Some context on removing version from compose specification, as both useless and confusing for user who expect some validation: compose-spec/compose-spec#13

@tejksat
Copy link

tejksat commented Jul 20, 2021

@ndeloof thank you for the answer.

Then you probably want your parser code to be updated so it embrace the compose specification.

Do you particularly mean that the version attribute became optional in Compose configuration?

@ndeloof
Copy link
Collaborator

ndeloof commented Jul 20, 2021

version indeed became optional and useless (it doesn't trigger any specific validation)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix 🚫 This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants