containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
4.97k stars 474 forks source link

Error in podman-compose up command #1005

Open deboramlmaciel opened 1 month ago

deboramlmaciel commented 1 month ago

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:

real-codemeteor commented 1 month ago

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.

Willem-SN commented 1 month ago

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

ghost commented 1 month ago

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.

gdiepen commented 1 week ago

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