Describe the bug
When the build key in the compose.yml file is given a string representing a context directory and the Dockerfile cannot be found in that directory, it throws an error traceback that pollutes the output and is unnecessary for the user to see.
To Reproduce
compose.yml:
services:
server:
container_name: server
build: ./Dockerfile
command: sh -c "echo 'hello'"
The build argument represents a directory in which to search for a Dockerfile.
If the specified directory does not contain a Dockerfile, podman-compose rightfully throws an error.
Here, Dockerfile represents a file, and even if it exits, podman-compose does not find it (as expected).
Call podman-compose build.
Expected behavior
Only one line of error is shown, e.g.:
OSError: Dockerfile not found in /a/b/c/Dockerfile
Actual behavior
The entire error traceback is shown:
Traceback (most recent call last):
File "/a/b/c/./podman_compose.py", line 5462, in <module>
main()
~~~~^^
File "/a/b/c/./podman_compose.py", line 5455, in main
asyncio.run(async_main())
<...>
OSError: Dockerfile not found in /a/b/c/Dockerfile
Environment:
Debian GNU/Linux 13 (trixie)
Python 3.13.5
podman-compose version 1.6.0
podman version 5.4.2
Additional context
This should behave similarly to docker-compose:
$ docker-compose build
[+] Building 0.0s (0/0) docker:default
unable to prepare context: path "/a/b/c/Dockerfile" not found
Describe the bug
When the
buildkey in thecompose.ymlfile is given a string representing a context directory and theDockerfilecannot be found in that directory, it throws an error traceback that pollutes the output and is unnecessary for the user to see.To Reproduce
compose.yml:The build argument represents a directory in which to search for a Dockerfile.
If the specified directory does not contain a Dockerfile,
podman-composerightfully throws an error.Here,
Dockerfilerepresents a file, and even if it exits,podman-composedoes not find it (as expected).Call
podman-compose build.Expected behavior
Only one line of error is shown, e.g.:
OSError: Dockerfile not found in /a/b/c/DockerfileActual behavior
The entire error traceback is shown:
Environment:
Debian GNU/Linux 13 (trixie)
Python 3.13.5
podman-compose version 1.6.0
podman version 5.4.2
Additional context
This should behave similarly to
docker-compose: