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

docker compose config doesn't output version #9907

Closed
AlexNik opened this issue Oct 10, 2022 · 4 comments
Closed

docker compose config doesn't output version #9907

AlexNik opened this issue Oct 10, 2022 · 4 comments

Comments

@AlexNik
Copy link

AlexNik commented Oct 10, 2022

Description
I have used docker-compose config command for workaround this issue moby/moby#29133 (comment)
I want to rewrite my code to use docker compose command instead but the output does not contains the version of file like when I use docker-compose command and docker stack deploy can't proccess it: unsupported Compose file version: 1.0

Steps to reproduce the issue:
example.yml

version: "3.9"

docker-compose output (version 1.29.2):

alex@alex:~/example$ docker-compose -f example.yml config
services: {}
version: '3.9'
alex@alex:~/example$ docker stack deploy -c <(docker-compose -f example.yml config) test
alex@alex:~/example$ echo $?
0

docker compose output (version 2.11.2):

alex@alex:~/example$ docker compose -f example.yml config
name: example
services: {}
alex@alex:~/example$ docker stack deploy -c <(docker compose -f example.yml config) test
unsupported Compose file version: 1.0
alex@alex:~/example$ echo $?
1

Describe the results you expected:
I expect the output like from docker-compose command version 1.29.2

Output of docker compose version:

Docker Compose version v2.11.2

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.0-docker)
  compose: Docker Compose (Docker Inc., v2.11.2)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 176
 Server Version: 20.10.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 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: 15remj0l09wglxwae4mguln85
  Is Manager: true
  ClusterID: ka36yctf8ep6keflzqi6ou93a
  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.44.76
  Manager Addresses:
   192.168.44.76:2377
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-193-generic
 Operating System: Ubuntu 18.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.788GiB
 Name: alex
 ID: OQE4:TJOF:DDEG:SRFV:76E3:QW7B:VTYV:F647:3TRW:3GTN:AQYG:7VK2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: alexnik
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:

@milas
Copy link
Member

milas commented Oct 12, 2022

The top-level version element has been deprecated by compose-spec and is no longer used/respected by Compose v2.

See https://docs.docker.com/compose/compose-file/#version-top-level-element for details.

@milas milas closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
@AlexNik
Copy link
Author

AlexNik commented Oct 12, 2022

@milas ok
But how to do this now without error?
docker stack deploy -c <(docker-compose config) stack-name-here
deploy command require version
Is it a bug in docker project?

@AlexNik
Copy link
Author

AlexNik commented Oct 15, 2022

@milas Dirty hack is

docker stack deploy -c  <(docker compose config | echo -e "version: '3.9'\n$(cat -)") test-stack

@glours
Copy link
Contributor

glours commented Oct 17, 2022

@AlexNik docker stack commands don't belong to Docker anymore since Mirantis bought Docker Enterprise products in 2019.
You should ask to support the Compose Specification or to provide a custom parser of Compose file to address this issue.

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

No branches or pull requests

3 participants