Commit Graph

500 Commits

Author SHA1 Message Date
Monika Kairaityte 8e2cd2bab8 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 23:10:17 +03:00
Monika Kairaityte 35a66f5a8b 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:58:42 +03:00
Povilas Kanapickas bd29caa797 Release 1.4.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-05-10 15:24:32 +03:00
Elsa 67616bdaac Handle exit code when compose up -d
Signed-off-by: Elsa <zeyugao@outlook.com>
2025-05-10 14:38:53 +03:00
Povilas Kanapickas 7497692b19
Merge pull request #1184 from schnell18/main
Fix service_healthy condition enforcing
2025-05-10 14:20:06 +03:00
Justin Zhang 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
Justin Zhang 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
Justin Zhang 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
gtebbutt e1d938ffa6 Add --abort-on-container-failure
Signed-off-by: gtebbutt <5956226+gtebbutt@users.noreply.github.com>
2025-05-10 13:41:29 +03:00
Sebastian Sellmeier 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
Elsa 98f166d2e4 Implement pids_limit
Signed-off-by: Elsa <zeyugao@outlook.com>
2025-04-21 22:51:37 +03:00
Romain Gasquet 8d899ebb65 Feature: add cpuset option
Signed-off-by: Romain Gasquet <romain.gasquet@neutron.fr>
2025-04-19 14:10:30 +02:00
Povilas Kanapickas 342a39dcfe
Merge pull request #1179 from knarfS/fix_port_cmd
Fix port command
2025-04-14 18:05:53 +03:00
Povilas Kanapickas d6b8476573
Merge pull request #1180 from knarfS/add_rmi_arg
Add rmi argument for down command
2025-04-14 18:04:09 +03:00
Frank Stettner 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
Frank Stettner 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
Yashodhan Pise 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
Monika Kairaityte 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
Monika Kairaityte 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
Piotr Kubiak 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
Povilas Kanapickas 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
Ruben Jenster 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
Ruben Jenster 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
Mohammad Kazemi f106ea0c01 modifications to pass pylint test
Signed-off-by: Mohammad Kazemi <mokazemi@disroot.org>
2025-03-19 15:55:55 +03:30
Mohammad Kazemi 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
Mohammad Kazemi 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
charliemirabile 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
Rafael Guterres Jeffman 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
Povilas Kanapickas 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
Ian Fijolek 4cd1642be0 Add quiet flag to podman-compose config
This skips printing and is useful for validating config files.

Signed-off-by: Ian Fijolek <ian@iamthefij.com>
2025-02-28 12:48:08 -08:00
Alexandre Pita 37b27fa233 Refactor event loop handling to simplify logic for Windows platforms
Signed-off-by: Alexandre Pita <alexandreanpita@gmail.com>
2025-02-26 17:28:59 +00:00
Italo Maia c6b3d497d6 Adds lint exclusions already ignored by the code
Added flake8 excludes to rules that are already ignored by the current
code to avoid validation issues with code that has already been
approved. Added pylint disable to line with lint offense already
accepted.

Signed-off-by: Italo Maia <italo.maia@gmail.com>
2025-02-26 17:57:34 +02:00
Alexandre Pita 784d798dac Fix event loop handling for Windows platform in compose_up function
Signed-off-by: Alexandre Pita <alexandreanpita@gmail.com>
2025-02-26 14:38:46 +00:00
Yusuke Matsubara baccce4f3f Fix comments related to logging
Signed-off-by: Yusuke Matsubara <whym@whym.org>
2025-02-25 01:38:41 +02:00
Jörn Hirschfeld 1cdc9e6552 interface_name can be specified in net_config_
Signed-off-by: Jörn Hirschfeld <joern@hirschfeld.tech>
2025-02-23 17:04:10 +01:00
Povilas Kanapickas 15380a809d
Merge pull request #1135 from rpluem-vf/keep_fds_open
Do not close file descriptors when executing podman
2025-02-18 13:26:15 +02:00
Ruediger Pluem d4e5859370 Do not close file descriptors when executing podman
Do not close file descriptors when executing podman. This allows
externally created file descriptors to be passed to containers.
These file descriptors might have been created through systemd
socket activation. See also
https://github.com/containers/podman/blob/main/docs/tutorials/socket_activation.md#socket-activation-of-containers

Signed-off-by: Ruediger Pluem <ruediger.pluem@vodafone.com>
2025-02-12 11:35:51 +01:00
Matthias Schiffer 43a2f1d01f
Implement x-podman.pod_args to override --pod-args default
Allow setting an argument list as x-podman.pod_args to override the
default value `--infra=false --share=`. `--pod-args` passed on the command
line takes precedence over the value set in docker-compose.yml; the values
are not merged.

Fixes #1057.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2025-02-07 12:11:19 +01:00
notdian e03d675b9b Remove incorrect os.chdir call to fix folder error
Signed-off-by: notdian <dian@fishekqi.com>
2025-01-31 01:24:24 +02:00
Povilas Kanapickas 51d180d2d0
Merge pull request #1120 from mokibit/inform-user-to-use-newer-python
Throw a readable error on too old Python
2025-01-27 21:53:24 +02:00
Monika Kairaityte bdb3e4e984 Throw a readable error on too old Python
podman-compose v1.0.6 is the last to support Python3.6. When newer
podman-compose version is used with too old Python, podman-compose gives
only a confusing error. This commit gives a clear message to use
upgraded Python version.
A descriptive error can not be thrown, as line "from __future__ imports"
must occur at the beginning of the file, but older Python (older than
Python3.7) does not recognize __future__ and throws an error
immediately.
Therefore, a comment is used to inform the user to update his Python
version.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2025-01-27 21:49:50 +02:00
Zeglius 105e390f6b Add support for dockerfile_inline
Fixes #864

Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com>
2025-01-27 21:45:42 +02:00
Povilas Kanapickas f376700972
Merge pull request #1104 from rjeffman/disable_dns
Add support for disable_dns, dns and ignore on network creation
2025-01-19 19:41:30 +02:00
Rafael Guterres Jeffman 9be3ec985f Add network "dns" support
This patch add 'x-podman.dns' option to the 'network' configuration,
allowing users to set the DNS resolvers for a defined network.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-01-17 13:58:13 -03:00
Rafael Guterres Jeffman 6e642dca1f Add network "disable-dns" support
Podman allows to create a network disabling the DNS plugin with
'--disable-dns', but this option is not available in the compose spec.

This patch add 'x-podman.disable-dns' to the podman-compose options,
allowing the creation of a network with the DNS plugin disabled.

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-01-17 12:14:15 -03:00
indra 2aa042b9c7 expand service environment_variables before adding to subs_dict
Also modifies an existing integration test to expect an empty string as `docker-compose` warns that
`ZZVAR3` is not set and defaults it to an empty string per the acutal output here.

```yaml
$ docker-compose -f container-compose.load-.env-in-project.yaml config
WARN[0000] The "ZZVAR3" variable is not set. Defaulting to a blank string.
name: project
services:
  app:
    command:
      - /bin/busybox
      - sh
      - -c
      - env | grep ZZ
    environment:
      ZZVAR1: This value is loaded but should be overwritten
      ZZVAR2: This value is loaded from .env in project/ directory
      ZZVAR3: ""
...
```

Signed-off-by: indra <indra.talip@gmail.com>
2025-01-16 21:00:49 +11:00
Emanuel Rietveld bc4177fbdc Exclude dependent containers on up if --no-deps.
Fixes #398.

Signed-off-by: Emanuel Rietveld <e.j.rietveld@gmail.com>
2025-01-15 22:32:28 +01:00
Emanuel Rietveld 8206cc3ea2 Run should not add --requires if --no-deps.
Fixes #717.

Signed-off-by: Emanuel Rietveld <e.j.rietveld@gmail.com>
2025-01-15 22:29:51 +01:00
Povilas Kanapickas 9cbc4c1dcd Release 1.3.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:16:01 +02:00
Felix Rubio 804852b218 Provide support for cache_from and cache_to fields
Signed-off-by: Felix Rubio <felix@kngnt.org>
2025-01-05 12:35:30 +02:00