von-network icon indicating copy to clipboard operation
von-network copied to clipboard

undocumented docker compose V2 requirement

Open Moopli opened this issue 3 years ago • 12 comments

This recent commit introduces a dependency on the docker compose V2 plugin, which is as-yet in beta and not distributed to all clients, eg, linux docker command lines, as are common on dev machines (like mine) and in CI environments.

Moopli avatar Sep 09 '21 18:09 Moopli

@WadeBarnes is this an intentional breaking change?

Moopli avatar Sep 09 '21 18:09 Moopli

For me the changes work with docker-compose 1.29.2 and the experimental docker-compose V2. What version are you running and what errors are you seeing?

WadeBarnes avatar Sep 09 '21 18:09 WadeBarnes

I tested with docker-compose 1.29.2, but FYI I had to delete my old docker images before running ./manage build (there was some docker caching issue)

ianco avatar Sep 09 '21 18:09 ianco

We also have tagged releases now, so you could checkout v1.7.0 which is the release right before the updates for docker-compose; https://github.com/bcgov/von-network/releases

WadeBarnes avatar Sep 09 '21 18:09 WadeBarnes

@Moopli, Regardless, let me know the behaviour you are seeing and I might be able to add support for the old and new command syntax.

WadeBarnes avatar Sep 09 '21 18:09 WadeBarnes

Thanks guys, I can work with v1.7.0 for now, but here's the error I'm seeing on master:

./manage up
unknown shorthand flag: 'd' in -d

And this seems to manifest as a result of docker compose not being recognized by my docker installation, which is Docker Engine - Community, version 20.10.6.

I suppose if you want to gracefully fallback to using docker-compose, when docker compose isn't supported, that would be convenient; but as far as I understand, the docker team is planning on rolling out the V2 plugin by default across all clients soon enough, so this issue wouldn't bite many people, hopefully :wink:.

Moopli avatar Sep 10 '21 02:09 Moopli

I'm running into the same issue as @Moopli

./manage start
unknown shorthand flag: 'd' in -d

Setup:

  • Docker Compose version 2.1.1
  • Docker version 20.10.10, build b485636f4b

Problem: The script correctly detects a docker compose >= 2.0 and sets the dockerCompose variable to "docker --log-level error compose" https://github.com/bcgov/von-network/blob/25a64cc820cb7750e655aa1d84ef20c196abaa56/manage#L28-L30

The command docker --help yields

Management Commands:
  ...
  compose*    Docker Compose (Docker Inc., 2.1.1)
  ...

And it seems to simply invoke the docker-compose binary which in turn does not support --log-level

To reproduce :

docker compose up -d webserver works fine.

But

docker --log-level error compose down -d webserver

fails with the unknown shorthand flag: 'd' in -d error

Solution: Simply remove the --log-level part in https://github.com/bcgov/von-network/blob/25a64cc820cb7750e655aa1d84ef20c196abaa56/manage#L30 for now.

xoryouyou avatar Nov 18 '21 12:11 xoryouyou

I am able to reproduce the issue reported by @xoryouyou, by upgrading Docker so Docker Compose is v2.1.1. Proper parsing of the docker --log-level <level> flag before invoking docker compose seems to have been broken between Docker Compose v2.0.0 and v2.1.1. You can use docker --log-level <level> syntax with other management commands without issue, just not compose anymore.

The other workaround, that I use, is to turn off Use Docker Compose V2 in General Settings.

I'll have a look into this a bit more to see if there is anything we can do other than work around the issue, but this is looking like a bug in docker. Based on the help text that comes back when the commands fail the docker --log-level <level> compose syntax should work; it's listed as a valid option.

WadeBarnes avatar Nov 18 '21 14:11 WadeBarnes

I have a workaround - that worked for me. I just unchecked "Docker Compose V2" from my Docker Desktop Preferences to be able to successfully run ./manage build and ./manage start successfully. I've added this a Note in README.md section to help others "https://github.com/bcgov/von-network#running-the-web-server-in-docker-against-another-ledger"

satishsurath avatar Jan 03 '22 15:01 satishsurath

Problem reproduced with docker version 20.10.17 and docker compose version v2.6.1.

Having problems to run docker-desktop. Do you know of any other workaround, perhaps manual execution of the command in order to start the network?

jruizaranguren avatar Jul 21 '22 07:07 jruizaranguren

@jruizaranguren,

Uncheck Use Docker Compose V2: image

WadeBarnes avatar Jul 21 '22 11:07 WadeBarnes

Thanks @WadeBarnes. I was doing the tests in an Ubuntu 18:04 machine. It seems that docker-desktop is not fully supported, so I ended up testing it in play-with-docker.

jruizaranguren avatar Jul 22 '22 08:07 jruizaranguren