cage icon indicating copy to clipboard operation
cage copied to clipboard

docker-compose.yml `version` is not preserved

Open erithmetic opened this issue 6 years ago • 5 comments

Example project:

.
└── pods
   ├── db.yml
# in pods/db.yml
version: "2.1"
services:
  db:
    healthcheck:
      test: ["CMD", "true"]

When I run cage up I get:

ERROR: The Compose file '/foo/.cage/pods/db.yml' is invalid because:
Unsupported config option for services.db: 'healthcheck'
Error: error running 'docker-compose -p foo -f /foo/.cage/pods/db.yml up -d'

Looking at /foo/.cage/pods/db.yml, I see that it's configured with version: "2".

Expected: /foo/.cage/pods/db.yml should have version: "2.1"

My hunch is that cage is creating an empty compose_yml::v2::File which gets a default version of "2": https://github.com/emk/compose_yml/blob/b660f32fd4579a7e90526b51e0b97456b0b23c3e/src/v2/file.rs#L102

erithmetic avatar Apr 02 '18 21:04 erithmetic

Let's just convert version: "2" to version: "2.1" whenever we can.

Oh, yeah, if you want me to look at PRs and I don't respond in a day or two, feel free to ping me again. The only way I see cage PRs this month is if they show up on GitHub notifications, and you should feel free to abuse them. :-)

emk avatar Apr 03 '18 11:04 emk

That sounds good. The minimum docker version for compose 2.1 is v1.12.0, which is almost 2 years old now.

erithmetic avatar Apr 03 '18 14:04 erithmetic

@dkastner @emk Any updates on this issue? I'd really love to use healthcheck.

roman-biqmind avatar Aug 03 '18 03:08 roman-biqmind

@dkastner @roman-biqmind Does anybody know the current state of any PRs associated with this? I'd like to take another look and see if there's anything I can merge. Thank you!

emk avatar Oct 03 '18 13:10 emk

At this point, we're using version: 2.4 as our internal version, and we're applying JSON validation on output using the official schemas from docker-compose. But we're outputting version: "2", and we should really output version: "2.4".

emk avatar Apr 15 '20 15:04 emk