What features do you find missing in compose?
https://docs.docker.com/compose/startup-order/
I see that they now recommend some workarounds to fix this issue, where I want to ensure that dependencies are running before spinning up my app. Usually, this is in the context of integration tests. The inability to support this "natively" makes the integration tests somewhat flaky and unreliable.
Re:Docker's Second Death
by nikisweeting on Sunday December 06, 2020 @03:30PM
(#25326366)
Docker-compose v2.4 is arguably much better than v3.0, and in a lot of ways they are really separate specs, not a "newer version" of an old spec. Compose v3 exists to push you towards swarm, whereas compose v2 exists to make docker-compose a complete mini cluster management tool, and succeeds at it in my experience.
We continue to use v2.4 in all our projects today because it allows you do easily do things like define startup order with healthchecks, as well as limit cpu, memory, etc. without having to spin up a whole swarm cluster.
I push for docker-compose v2 over v3 at work for the same reason. Just to spell out explicitly what nikisweeting is hinting at:
For local development use-cases, docker-compose v3 is just v2 minus all the features Docker Swarm doesn't support.
Re:Docker's Second Death
by nikisweeting on Sunday December 06, 2020 @05:52PM
(#25327442)
If anyone is curious, this is the native official way to define startup order using healthchecks present in v2.4 (but removed in v3 to push you towards swarm):
some_service:
depends_on:
other_service:
condition: service_healthy
Re:Docker's Second Death
by nikisweeting on Monday December 07, 2020 @09:40AM
(#25332496)
TIL this has been returned to compose in the latest version! They merged the specs in September so this is now officially supported again going forward. That fixes my last major gripe with compose trying to push people to swarm, which no longer seems to be the case after this merge.
If your language runtime supports testcontainers (https://www.testcontainers.org/) I would strongly suggest using that over docker compose. Docker compose is so lacking in features that I would just write bash scripts to setup/tear down container dependencies. But testcontainer removes the need to write bash scripts and provides some basic orchestration features that make it an absolute breeze to use.