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

Error in podman-compose up command

Open deboramlmaciel opened this issue 1 year ago • 7 comments

Describe the bug Error on configure a new environment

To Reproduce Download and execute the installer of Podman Execute the command "podman machine init" Execute the command "podman machine start" Execute the command "podman-compose up" in the directory with the yaml file

Expected behavior Successfully operation

Actual behavior Getting error bellow:

39b55938d65e4d94f3742381fa38f6dce655acec7fef186c6c3e08f37c287492 3970fa0ad1866f7befbf8052eceb8832d955f5405a658be3be4bacd275827bcf 37d70351d3c3ff66f5951f6451ccc4a59502c3b1c4922c004ebb43c5ecb82cf8 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Scripts\podman-compose.exe_main.py", line 7, in File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\podman_compose.py", line 3504, in main asyncio.run(async_main()) File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\podman_compose.py", line 3500, in async_main await podman_compose.run() File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\podman_compose.py", line 1743, in run retcode = await cmd(self, args) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\podman_compose.py", line 2521, in compose_up loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks]) File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py", line 578, in add_signal_handler raise NotImplementedError NotImplementedError

Environment:

  • OS: WSL on Windows
  • podman version: 5.1.2
  • podman compose version: (git hex) Docker Compose version v2.29.0

deboramlmaciel avatar Jul 19 '24 19:07 deboramlmaciel

I run into the same issue on Windows. podman-compose version 1.2.0 podman version 4.6.2

I had to downgrade podman-compose to version 1.0.6 to make it work again.

real-codemeteor avatar Jul 23 '24 10:07 real-codemeteor

same on arch linux

podman-compose version 1.2.0 podman version 5.1.2

Traceback (most recent call last):
  File "/usr/bin/podman-compose", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/podman_compose.py", line 3504, in main
    asyncio.run(async_main())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/podman_compose.py", line 3500, in async_main
    await podman_compose.run()
  File "/usr/lib/python3.12/site-packages/podman_compose.py", line 1743, in run
    retcode = await cmd(self, args)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/podman_compose.py", line 2470, in compose_up
    await compose.podman.output(
  File "/usr/lib/python3.12/site-packages/podman_compose.py", line 1362, in output
    raise subprocess.CalledProcessError(p.returncode, " ".join(cmd_ls), stderr_data)
subprocess.CalledProcessError: Command 'podman ps --filter label=io.podman.compose.project=projectname -a --format {{ index .Labels "io.podman.compose.config-hash"}}' returned non-zero exit status 125.

was working fine yesterday

edit:

fixed this on my system

podman-compose wasn't working because podman itself wasn't

installing the fuse-overlayfs package solved the issue

Willem-SN avatar Jul 24 '24 02:07 Willem-SN

At your own risk, you could try changing the line:

loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks])

in podman_compose.py, to:

signal.signal(signal.SIGINT, lambda signum, frame: [t.cancel("User exit") for t in tasks])

for the issue on Windows? This seemed to work for me, at the very least, allowing me to run my pods.

Credits to: hellopeach

Answer

However, the following is highlighted in a comment: Docs

Therefore, the above solution may be wrong and may break the cancellation of the tasks, I'm not exactly sure. In that case, an alternative may be to comment out the line altogether until a working solution is available.

On Windows, if a Terminate batch job (Y/N)? when you press CTRL+C, you're likely invoking podman-compose from a batch script (.BAT or .CMD). If you wish to suppress that prompt, and if you do not require user input to the script, a suggested workaround is to append < NUL to the command-line when invoking the batch script (i.e.: LAUNCH_MY_PODS.CMD < NUL). *All input will be suppressed.

ghost avatar Aug 07 '24 05:08 ghost

I am experiencing the same problem with podman-compose 1.2.0 on windows. Using the exact same docker-compose.yml on a mac system, also with podman-compose 1.2.0 I do not get any errors.

Both downgrading to 1.0.6 resolved the issue (but not so happy with the legacy output) as well as the modification referenced in the comment above. Would be great if this could be made in such a way that the script works cross platform

gdiepen avatar Sep 03 '24 06:09 gdiepen

I am experiencing the same problem on a MacBook pro M3.

Traceback (most recent call last): File "/opt/homebrew/bin/podman-compose", line 8, in <module> sys.exit(main()) ~~~~^^ File "/opt/homebrew/Cellar/podman-compose/1.2.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 3504, in main asyncio.run(async_main()) ~~~~~~~~~~~^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 194, in run return runner.run(main) ~~~~~~~~~~^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 720, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "/opt/homebrew/Cellar/podman-compose/1.2.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 3500, in async_main await podman_compose.run() File "/opt/homebrew/Cellar/podman-compose/1.2.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 1743, in run retcode = await cmd(self, args) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/podman-compose/1.2.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 2470, in compose_up await compose.podman.output( ...<9 lines>... ) File "/opt/homebrew/Cellar/podman-compose/1.2.0/libexec/lib/python3.13/site-packages/podman_compose.py", line 1362, in output raise subprocess.CalledProcessError(p.returncode, " ".join(cmd_ls), stderr_data) subprocess.CalledProcessError: Command 'podman ps --filter label=io.podman.compose.project=juzt-core -a --format {{ index .Labels "io.podman.compose.config-hash"}}' returned non-zero exit status 125. error: Recipe servicesfailed with exit code 1

sir-stevie avatar Jan 02 '25 09:01 sir-stevie

This is still an issue in 1.3.0 on Windows. As @real-codemeteor observed, podman-compose worked only after downgrading to 1.0.6 (all higher versions encountered the same issue).

Podman Client: 5.4.0 Podman Server: 5.1.1 OS: Windows 11 Python: 3.13.2

drath3000 avatar Feb 19 '25 03:02 drath3000

For your information, this is now fixed with https://github.com/containers/podman-compose/commit/784d798dac8ac1a763e12d83d6ed94ee9d2e7dca.

You can install the edge version waiting for a release to be cut:

$ pip uninstall podman-compose
$ pip install https://github.com/containers/podman-compose/archive/main.tar.gz

rdupret avatar Apr 10 '25 13:04 rdupret