skip to Main Content

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:Usersmmo>podman-compose --version
podman-compose version: 1.0.6
['podman', '--version', '']
Traceback (most recent call last):
  File "C:Python310librunpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:Python310librunpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:Usersmmovenv-podmanScriptspodman-compose.exe__main__.py", line 7, in <module>
  File "C:Usersmmovenv-podmanlibsite-packagespodman_compose.py", line 2941, in main
    podman_compose.run()
  File "C:Usersmmovenv-podmanlibsite-packagespodman_compose.py", line 1406, in run
    self.podman.output(["--version"], "", []).decode("utf-8").strip()
  File "C:Usersmmovenv-podmanlibsite-packagespodman_compose.py", line 1098, in output
    return subprocess.check_output(cmd_ls)
  File "C:Python310libsubprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:Python310libsubprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:Python310libsubprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:Python310libsubprocess.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:Usersmmo>

Any idea?

2

Answers


  1. Chosen as BEST ANSWER

    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...


  2. Basically it’s the same process as installing "podman-compose" into WSL (or any other Linux distro):

    1. Install Python for Windows: https://www.python.org/downloads/

    2. Create a virtual environment and install "podman-compose":

      C:somedir> python.exe -m venv venv-podman
      C:somedir> venv-podmanScriptsactivate.bat
      (venv-podman) C:somedir> pip install podman-compose
      (venv-podman) C:somedir> podman-compose --version
      

    You can now call podman-compose from all other directories, because it was put into your search path by activate.bat.

    If you exit this CMD (Windows Command Prompt), you just have to execute the second step again (e.g. calling activate.bat).

    Update: This is the whole input and output on the shell:

    D:>C:Python310python.exe -m venv venv-podman
    
    D:>venv-podmanScriptsactivate
    
    (venv-podman) D:>pip install podman-compose
    Collecting podman-compose
      Using cached podman_compose-1.0.6-py2.py3-none-any.whl (34 kB)
    Collecting pyyaml
      Using cached PyYAML-6.0-cp310-cp310-win_amd64.whl (151 kB)
    Collecting python-dotenv
      Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)
    Installing collected packages: pyyaml, python-dotenv, podman-compose
    Successfully installed podman-compose-1.0.6 python-dotenv-1.0.0 pyyaml-6.0
    WARNING: You are using pip version 21.2.3; however, version 23.1.2 is available.
    You should consider upgrading via the 'D:venv-podmanScriptspython.exe -m pip install --upgrade pip' command.
    
    (venv-podman) D:>podman-compose --version
    podman-compose version: 1.0.6
    ['podman', '--version', '']
    using podman version: 4.5.1
    podman-compose version 1.0.6
    podman --version
    podman version 4.5.1
    exit code: 0
    
    (venv-podman) D:>
    

    Concerning the updated post (python stacktrace): Is podman.exe in your path? podman --version should ouput your podman version – regardless of whether you are in the venv or not. After installing Podman Desktop, this should be in your path.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search