containers / containers/podman-compose

`podman-compose up` swallows exit code

Open
#626 4 comments 7 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**

Related to #586 but for `up` instead of `build`.

`podman-compose up` always returns a success result code, even when the command fails.

This is an issue, for example, in [this script](https://gitlab.com/bronson/veloren-serve/-/blob/c0bddb8a905b98f615ff1f259621eb04963686ea/resume#L40): if `podman-compose up` fails, the script should error out (because it's `set -e`) and _not_ run `podman-compose logs` on failed containers.

To reproduce, create this podman-compose.yml:

```yaml
version: "3.5"
services:
container:
image: this-image-is-SO-unusable
```

And run these commands:

```sh
sudo podman-compose up || echo FAILED
echo result code: $?
```

"FAILED" should be printed after the podman-compose command, and podman claims the exit code should be 125:

Instead, "FAILED" is _not_ printed, and the result code is 0: success!

```txt
Error: repository name must be lowercase
exit code: 125
podman start -a tmp_container_1
Error: unable to start container cad728e9678a340b717ef681b6a806d68432b28fcf1c138bc02eb1219c99f44c: netavark: setns: IO error: Operation not permitted (os error 1)
exit code: 125
result code: 0
```

**Environment:**

```
$ podman-compose version
['podman', '--version', '']
using podman version: 4.4.0-rc2
podman-composer version 1.0.3
podman --version
podman version 4.4.0-rc2
exit code: 0
```

- OS: Linux (Fedora Silverblue)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.