gabrieldemarmiesse / python-on-whales

An awesome Python wrapper for an awesome Docker CLI!
MIT License
537 stars 100 forks source link

compose.config fails with docker compose v2.25.0 #569

Closed HemaZ closed 4 months ago

HemaZ commented 5 months ago

Hello,

It seems calling DockerCompose.config now fails with dokcer compose v2.25.0

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ibrahim/lib/python3.10/site-packages/python_on_whales/components/compose/cli_wrapper.py", line 137, in config
    return ComposeConfig(**json.loads(result))
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

i found a releated issue on docker compose repo

https://github.com/docker/compose/issues/11627

it seems that docker compose config ignore --format arg unless--no-interpolate is passed.

so

docker compose -f docker-compose.yaml config --format=json will output yaml

docker compose -f docker-compose.yaml config --format=json --no-interpolate will output json

gabrieldemarmiesse commented 5 months ago

Hi, thanks for the bug report, it seems it was fixed in docker compose: https://github.com/docker/compose/pull/11630 We should wait until the new release to see if it works

HemaZ commented 4 months ago

i just upgraded docker compose version v2.26.1 and this is now fixed. closing this issue. sorry for the noise.

gabrieldemarmiesse commented 4 months ago

No worries, I think opening this issue helped people who got the same bug :)