UnownHash / Fletchling

10 stars 3 forks source link

fix old docker compose CLI used in script #32

Closed na-ji closed 6 months ago

na-ji commented 6 months ago

Since three years ago, compose is included in docker CLI. You don't need to install any compose plugin on top of docker. Because of that, the command to use it is now docker compose and not docker-compose.

comstud commented 6 months ago

I'm aware of this, at least the plugin part, but I do not have a new enough docker:

$ docker --version
Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1

$ docker compose
docker: 'compose' is not a docker command.
comstud commented 6 months ago

I guess a check could be added to the script to determine which one to run.

comstud commented 6 months ago

(Thanks though, I completely didn't think of this)

comstud commented 6 months ago

I think if we do something like the following, everyone will be happy:

which docker-compose > /dev/null
if [ $? -eq 0 ]; then
  command='docker-compose'
else
  command='docker compose'
fi
$command exec ...

Gonna sleep, but I can either push that up to this tomorrow, or you can, or maybe you have a better idea! Thanks

na-ji commented 6 months ago

I'm aware of this, at least the plugin part, but I do not have a new enough docker:

$ docker --version
Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1

$ docker compose
docker: 'compose' is not a docker command.

I wasn't aware Ubuntu 22 was still shipping with the compose plugin, since I always followed docker installation procedure instead of installing from the base repository.

I think if we do something like the following, everyone will be happy:

which docker-compose > /dev/null
if [ $? -eq 0 ]; then
  command='docker-compose'
else
  command='docker compose'
fi
$command exec ...

Gonna sleep, but I can either push that up to this tomorrow, or you can, or maybe you have a better idea! Thanks

Seems to be a good compromise. I've updated my PR. I haven't tried it though.

comstud commented 6 months ago

I wasn't aware Ubuntu 22 was still shipping with the compose plugin, since I always followed docker installation procedure instead of installing from the base repository.

No worries. Honestly, I wasn't sure how I'd installed it until I looked. But, yeah, it's the latest available for 22.04, so I think we gotta maintain this for now. But now, you've reminded me that I've wanted to get onto newer docker. hehe

[...]

Seems to be a good compromise. I've updated my PR. I haven't tried it though.

Thanks, will look!