podman-compose

How to execute podman-compose from a windows command line?


I have replaced "Docker Desktop for Windows" with Podman and Podman Desktop. I also installed podman-compose. podman and podman-compose run fine on the WSL command line (I installed an Ubuntu distro). I can also execute "podman" on the Windows command line (in both, cmd and PowerShell). However, "podman-compose" is not recognized as a command.

What is required to also be able to execute "podman-compose" on the Windows command line? I googled around but all instructions I found seem to assume that one executes that in a shell in WSL.

Is this possible at all? I can imagine that passing the current Windows path to the shell in WSL and other details may be a bit of a problem...

Addition - response to @mre (below):

Thanks for the instructions. I executed them. The first three lines went OK, but the last one yields:

(venv-podman) C:\Users\mmo>podman-compose --version
podman-compose version: 1.0.6
['podman', '--version', '']
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\mmo\venv-podman\Scripts\podman-compose.exe\__main__.py", line 7, in <module>
  File "C:\Users\mmo\venv-podman\lib\site-packages\podman_compose.py", line 2941, in main
    podman_compose.run()
  File "C:\Users\mmo\venv-podman\lib\site-packages\podman_compose.py", line 1406, in run
    self.podman.output(["--version"], "", []).decode("utf-8").strip()
  File "C:\Users\mmo\venv-podman\lib\site-packages\podman_compose.py", line 1098, in output
    return subprocess.check_output(cmd_ls)
  File "C:\Python310\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

(venv-podman) C:\Users\mmo>

Any idea?


Solution

  • Turned out that the issue running python scripts (and podman-compose apparently is just a python script) was a brain-damaged feature in Windows, namely two "Windows execution aliases" that - for whatever reason - were defined on my system. When calling "python" on the command line this opened the Windows Store offering to download and install python instead of actually starting Python (which I had already installed via the normal installer).

    It puzzled me enormously why entering "python" would bring up the windows store even though the Python install directory was on the path. I finally found an explanation for that "phenomenon" and a solution how to remove that garbage here: CMD opens Windows Store when I type 'python' Removing/disabling this "alias" also fixed the issue with podman-compose...