Open gwallet opened 1 year ago
I can confirm the error mentioned above.
When executing the following code, it throws an error:
podman-compose --podman-args "-c p1-root" up
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.5.0
** excluding: set()
['podman', 'ps', '-c', 'p1-root', '--filter', 'label=io.podman.compose.project=docker', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
Error: unknown shorthand flag: 'c' in -c
See 'podman ps --help'
Traceback (most recent call last):
File "/usr/bin/podman-compose", line 33, in <module>
sys.exit(load_entry_point('podman-compose==1.0.6', 'console_scripts', 'podman-compose')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2940, in main
podman_compose.run()
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1422, in run
cmd(self, args)
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1753, in wrapped
return func(*args, **kw)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2037, in compose_up
compose.podman.output(
File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1097, in output
return subprocess.check_output(cmd_ls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['podman', 'ps', '-c', 'p1-root', '--filter', 'label=io.podman.compose.project=docker', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']' returned non-zero exit status 125.
It looks like podman-compose
executes podman ps
first and then inserts the 'podman-args' arguments afterwards. Therefore, it does not work. The execution order should be reversed as for example podman -c p1 ps
instead of podman ps -c p1
.
Did you ever found a solution?
This seems to work for me:
podman-compose --podman-run-args="--cpus=1.5" up -d
Install podman-remote, setup a remote connection and then use it like so
$ podman-compose --podman-path="/usr/bin/podman-remote" ps
Note, that there are still conrner cases that dont work with the approach if the compose references some local volumes, their absolute path needs to exist on the remote machine running the podman.
I've moved on to Quadlet e.g systemd containers. This also gives you the benefits of applying quota flags, and you can even apply system(d) settings.
The only disadvantages is that it only works for systemd and the user needs to place/sync container files, instead of providing one simple compose file.
I was attempting the following but it also fails:
podman-compose --podman-start-args="--health-on-failure=restart" up -d
Sadly, podman-compose doesn't support restart pod on failure.
Describe the bug I want to use the remote capability of docker to deploy containers on a remote host.
podman-compose
knows nothing about this feature, but the doc says:I'm understanding that one can pass argument to
podman
thanks to--podman-args
. The hope here is to letpodman-compose
talk locally topodman
, using--podman-args="--remote"
the later will be driving a remote host, and that it will be smooth.There are also several
--podman-{CMD}-args
flags to pass arguments to dedicated command, which is not what I'm looking for. (at least, not at the moment)To Reproduce Steps to reproduce the behavior:
setup a remote host with podman installed and ready to serve remotely
add a podman connection to the host
$ podman system connection add --default remote ssh://user@remote
check the remote access with podman
$ podman --remote container ls
check the remote access with podman-compose
$ podman-compose --project-name my-project --podman-args="--remote" ps
The
--remote
flag is set afterps
and not afterpodman
podman is doing well when asking with the right command line:
$ podman --remote ps -a --filter label=io.podman.compose.project=my-project
list all the container running remotelyExpected behavior Running
podman-compose --help
saysI'm expecting the
args
to be passed to podman and not the the sub-command: Expecting: ✅podman --remote ps -a --filter label=io.podman.compose.project=my-project
Got: ❎podman ps --remote -a --filter label=io.podman.compose.project=my-project
Actual behavior Actually, arguments sent to
podman-compose
via--podman-args
are given to the sub-command and not to podman globally as mentioned in the doc.Output
Environment:
Additional context
As a workaround, it's always possibe to send podman-compose commands via SSH, but want to avoid sending the compose file via SCP, and keeping things on the driver computer.
I hope it's clear, if not I'll be happy to clarify 🙂
Regards,