faradayio / cage

Develop and deploy complex Docker applications
http://cage.faraday.io
Apache License 2.0
307 stars 26 forks source link

docker-compose.yml `version` is not preserved #89

Open erithmetic opened 6 years ago

erithmetic commented 6 years ago

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

emk commented 6 years ago

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. :-)

erithmetic commented 6 years ago

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

roman-biqmind commented 6 years ago

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

emk commented 5 years ago

@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 commented 4 years ago

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".