Commit Graph

521 Commits

Author SHA1 Message Date
dd471c8918 Fix dockerfile definition if directory name ends with ".git"
After changes in 92f0a8583a, the
dockerfile parameter is igored if the (local) work directory's name ends
in `.git`.
This commit fixes the regression and adds more tests.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-06-17 19:43:29 +03:00
4177bae807 Add docker_compose_compat setting
Signed-off-by: Uosis <uosisl+github@gmail.com>
2025-06-15 18:31:06 -06:00
6635b8b570 cleanup bool parsing
Signed-off-by: Uosis <uosisl+github@gmail.com>
2025-06-13 19:20:09 -06:00
8f55227167 add name_separator_compat
Signed-off-by: Uosis <uosisl+github@gmail.com>
2025-06-13 19:20:09 -06:00
605495233e allow overriding x-podman using env vars 2025-06-11 22:27:45 +03:00
0491269f53 Fix relative host path resolution for volume bind mount source
e03d675b9b broke relative host path
resolution by deleting os.chdir(). After this commit current working
directory is not relevant anymore.

Fixes e03d675b9b.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-06-05 16:46:07 +03:00
ee90712843 Merge pull request #1210 from jarovo/main
Add relabel option to secrets
2025-06-05 13:02:18 +03:00
82d7622c45 Add relabel option to secrets
On selinux enabled system, the secrets cannot be read without proper
relabeling or correct policy being set.

This patch enables user to instruc podman-copose to use :z or :Z podman
volume options to make podman relabel the file under bind-mount.

More info here:
https://unix.stackexchange.com/questions/728801/host-wide-consequences-of-setting-selinux-z-z-option-on-container-bind-mounts?rq=1

Signed-off-by: Jaroslav Henner <1187265+jarovo@users.noreply.github.com>
2025-06-05 00:13:58 +02:00
7b3276e5d7 Expose io.podman.compose.service label
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-29 22:01:35 +03:00
0b8b483cb7 Print full dockerfile path instead of context on error
Current error message does not provide the exact path where the
Dockerfile is being searched.

This commit distinguishes two types of errors when Dockerfile is not
found in build context:
- when the context does not have provided custom-named Dockerfile, the
path in the error message is absolute: "OSError: Dockerfile not found in
.../podman-compose/tests/integration/build_fail/context_no_file/custom-named-Dockerfile"
- when the context does not have any Dockerfile, the path in the error
message is: "OSError: Dockerfile not found in
.../podman-compose/tests/integration/build_fail/context_no_file"
Only this error message was used before the fix.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
Co-authored-by: Siteshwar Vashisht <svashisht@redhat.com>
2025-05-28 16:19:38 +03:00
efea0ee652 Address unused argument warnings
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 17:26:31 +03:00
5765e5306b Use correct logging methods
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 17:19:29 +03:00
0be50ffdfb Fix return value from compose_systemd()
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 17:19:29 +03:00
6c46678082 Fix mypy warnings
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 17:19:29 +03:00
39e21d8c11 Remove extraneous await on non-async function
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 15:29:53 +03:00
02166f584a Use more standard call to list.append
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 15:29:53 +03:00
8aeeafb98c Rename redefined variables
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 15:29:53 +03:00
9162fe6438 Remove unused code
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-24 15:29:49 +03:00
08d06df0f2 Fix build ssh path to be relative to directory of compose file
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-05-24 12:58:59 +03:00
76b3055934 Fix CMD healthchecks running with /bin/sh
Signed-off-by: Ben Krieger <ben.krieger@intel.com>
2025-05-20 16:54:25 +03:00
3d47849d28 Allow specifying custom pod name in --in-pod
Fixes #958: missing or incorrect use of --in-pod and pod-args
Fixes #693: --in-pod 'name' no function

Signed-off-by: norbiros <norbiros@protonmail.com>
Signed-off-by: Norbiros <norbiros@protonmail.com>
2025-05-18 18:46:15 +03:00
0c1c4ffea9 Fix reset tag attribute to also reset depends_on parameter
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-05-16 22:33:00 +03:00
01214fa013 Add unregister command to remove systemd service registration
Signed-off-by: marat2509 <marat2509@users.noreply.github.com>
2025-05-12 22:53:09 +03:00
bd29caa797 Release 1.4.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-10 15:24:32 +03:00
67616bdaac Handle exit code when compose up -d
Signed-off-by: Elsa <zeyugao@outlook.com>
2025-05-10 14:38:53 +03:00
7497692b19 Merge pull request #1184 from schnell18/main
Fix service_healthy condition enforcing
2025-05-10 14:20:06 +03:00
d7762a54f0 Fix service_healthy condition enforcing
Skip dependency health check to avoid compose-up hang for podman prior
to 4.6.0, which doesn't support --condition healthy.

Signed-off-by: Justin Zhang <schnell18@gmail.com>
2025-05-10 14:12:27 +03:00
eba2ca2695 Skip running compose-down during up when there are no active containers
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-10 14:12:18 +03:00
9e0da82726 Change compose-up to create then start container to avoid double exec
Signed-off-by: Justin Zhang <schnell18@gmail.com>
2025-05-10 13:58:23 +03:00
e1d938ffa6 Add --abort-on-container-failure
Signed-off-by: gtebbutt <5956226+gtebbutt@users.noreply.github.com>
2025-05-10 13:41:29 +03:00
cbe9587973 Implement override and reset analog to docker-compose
Corresponding Docker compose file documentation:
https://docs.docker.com/reference/compose-file/merge/

Signed-off-by: Sebastian Sellmeier <mail@sebastian-sellmeier.de>
Co-authored-by: Monika Kairaityte <monika@kibit.lt>
2025-04-30 23:37:05 +03:00
98f166d2e4 Implement pids_limit
Signed-off-by: Elsa <zeyugao@outlook.com>
2025-04-21 22:51:37 +03:00
8d899ebb65 Feature: add cpuset option
Signed-off-by: Romain Gasquet <romain.gasquet@neutron.fr>
2025-04-19 14:10:30 +02:00
342a39dcfe Merge pull request #1179 from knarfS/fix_port_cmd
Fix port command
2025-04-14 18:05:53 +03:00
d6b8476573 Merge pull request #1180 from knarfS/add_rmi_arg
Add rmi argument for down command
2025-04-14 18:04:09 +03:00
da46ee3910 Fix port command for dynamic host ports
Use `podman inspect` to get the actual host ports rather echoing the
defined ports from the compose yml.

Fixes #778 and #1039

Signed-off-by: Frank Stettner <frank-stettner@gmx.net>
2025-04-08 13:57:19 +02:00
cefa68dc75 Implement rmi argument for down command
Fixes #387

Signed-off-by: Frank Stettner <frank-stettner@gmx.net>
2025-04-08 13:53:27 +02:00
11879d3e94 Updates handling of scale/replicas through CLI & compose file
Signed-off-by: Yashodhan Pise <technoy@gmail.com>
2025-04-08 01:37:15 +03:00
92f0a8583a Fix using git URL as build context
Podman-compose actually did not work with git URL as build context.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-03-30 21:56:55 +03:00
5f4fc4618c Add os.path.normpath to normalize dockerfile pathname
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-03-28 22:28:30 +02:00
f9489afaf5 Allow merging of args in both list and dict syntax
Signed-off-by: Piotr Kubiak <piotr-kubiak@users.noreply.github.com>
2025-03-24 13:31:19 +02:00
7d7533772b Merge pull request #1165 from drachenfels-de/fix-project-name-interpolation
Fix `COMPOSE_PROJECT_NAME` interpolation
2025-03-20 19:26:03 +02:00
65b455f081 Fix project name evaluation order
The COMPOSE_PROJECT_NAME environment variable must override the
top-level name: attribute in the Compose file.

The precedence order is defined in the docker compose documentation
https://docs.docker.com/compose/how-tos/project-name/#set-a-project-name

Signed-off-by: Ruben Jenster <r.jenster@drachenfels.de>
2025-03-20 12:07:07 +01:00
98b9bb9f8e Fix interpolation for COMPOSE_PROJECT_NAME
Fixes #1073

Signed-off-by: Ruben Jenster <r.jenster@drachenfels.de>
2025-03-20 12:07:07 +01:00
f106ea0c01 modifications to pass pylint test
Signed-off-by: Mohammad Kazemi <mokazemi@disroot.org>
2025-03-19 15:55:55 +03:30
b748c2666c add try-except block to handle error in case of shutdown error
Signed-off-by: Mohammad Kazemi <mokazemi@disroot.org>
2025-03-19 15:55:50 +03:30
3973c476c4 catch SIGINT signal properly in 'up' function and call compose 'down' function for a graceful shutdown
Signed-off-by: Mohammad Kazemi <mokazemi@disroot.org>
2025-03-19 15:55:38 +03:30
2e7d83f7f0 Properly surface errors from build commands
the commit 38b13a3 ("Use asyncio for subprocess calls") broke the way
exit codes are reported from the podman compose build command.

The tasks are awaited as they finish which means that if a later build
finishes sucessfully after a failing build, it overwrites status.

Previously the `parse_return_code` function would skip updating the status
if the new return code was zero, but in removing it, this logic was not
carried forward.

Fixes: 38b13a3 ("Use asyncio for subprocess calls")
Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
2025-03-18 21:49:55 -04:00
d4760712b7 Don't raise exception on inexistent services in 'down' command
When running 'podman-compose down <service>', if service is not part of
the compose, a KeyError exception is raised in function 'get_excluded'.

By only allowing evaluation of services that exist in the compose
provides a cleaner and gentler exit for this case.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-03-05 15:49:52 -03:00
a54f0fa573 Merge pull request #1149 from AlexandreAANP/fix/windows-asyncio-loop
Fix event loop handling for Windows platform in compose_up function
2025-03-01 16:43:26 +02:00