compose-switch icon indicating copy to clipboard operation
compose-switch copied to clipboard

update-alternatives doesn't exist on every distro

Open ericb-summit opened this issue 4 years ago • 6 comments

I appreciate that this tool exists, but upate-alternatives / alternatives hardly exists everywhere (e.g. coreos, flatcar, etc...). It would be helpful if you could provide quickstart instructions on how to use the tool such a scenario.

This way people won't just version lock themselves to the latest v1 binary when they realize all their automations based on docker-compose are broken.

ericb-summit avatar Sep 30 '21 15:09 ericb-summit

Sure, then just setup your PATH to pick up compose-switch before legacy docker-compose V1.

ndeloof avatar Oct 03 '21 15:10 ndeloof

Can I call this wrapper simply docker-compose and put it in the path normally? In that case, how would this script find the real compose v2 binary?

ericb-summit avatar Oct 05 '21 21:10 ericb-summit

This script will just call docker compose. And docker compose is supposed to find Compose V2 because the latter is placed in cli-plugins dir somewhere under /usr, I forgot exact location.

slonopotamus avatar Oct 05 '21 21:10 slonopotamus

Compose V2 binary 2.0.1 actually includes some of the logic from this repo and can be used directly as docker-compose binary in your path

ndeloof avatar Oct 06 '21 05:10 ndeloof

Compose V2 binary 2.0.1 actually includes some of the logic from this repo and can be used directly as docker-compose binary in your path

Cool, that really solved it for us. In Alpine, we did the following:

ln -sf /usr/lib/docker/cli-plugins/docker-compose /usr/bin/docker-compose
docker-compose --version # CLI v1 compatibility mode
docker compose version # CLI v2 interface

Thx @ndeloof

Titus-von-Koeller avatar Dec 22 '21 11:12 Titus-von-Koeller

Compose V2 binary 2.0.1 actually includes some of the logic from this repo and can be used directly as docker-compose binary in your path

So... What is the recommended approach?

a. Use Docker Compose V2 as docker-compose b. Use compose-switch as docker-compose

slonopotamus avatar Jan 05 '22 20:01 slonopotamus