containers / containers/podman-compose

--podman-args passed arguments to subcommand instead of global as advertized

Open
#1,316 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Args after --podman-args will be passed to subcommand (e.g. images) instead of global.

**To Reproduce**

`podman-compose --podman-args="--connection remote-hostname" images`

**Expected behavior**
Correct results on the images for containers on the remote server

**Actual behavior**
Errored out

**Output**

```
$ podman-compose --version
podman-compose version 1.5.0
podman version 4.9.3
```

```
$ podman-compose --podman-args="--connection remote-hostname" images
...
raise subprocess.CalledProcessError(p.returncode, " ".join(cmd_ls), stderr_data)
subprocess.CalledProcessError: Command 'podman images --connection remote-hostname --format table my_container {{.Repository}} {{.Tag}} {{.ID}} {{.Size}} -n my_image:latest' returned non-zero exit status 125.
```
As you can see, the command generated is :
`podman images --connection remote-hostname --format table my_container {{.Repository}} {{.Tag}} {{.ID}} {{.Size}} -n my_image:latest`

The `--connection remote-hostname` is added after the `images` subcommand instead of right after `podman`.

In contrast, if I use the raw podman command with the correct order of the args, the results are as expected:

```
$ podman --connection remote-hostname images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest beae173ccac6 3 years ago 1.46 MB
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `podman-compose --podman-args="--connection remote-hostname" images`, then trace argument parsing and command construction for `--podman-args`. Done means the generated command places the connection argument before `images` and the remote image listing succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.