add a podman-compose command

**podman compose** is a thin wrapper around an external compose provider
such as docker-compose or podman-compose.  This means that `podman
compose` is executing another tool that implements the compose
functionality but sets up the environment in a way to let the compose
provider communicate transparently with the local Podman socket.  The
specified options as well the command and argument are passed directly
to the compose provider.

The default compose providers are `docker-compose` and `podman-compose`.
If installed, `docker-compose` takes precedence since it is the original
implementation of the Compose specification and is widely used on the
supported platforms (i.e., Linux, Mac OS, Windows).

If you want to change the default behavior or have a custom installation
path for your provider of choice, please change the `compose_provider`
field in `containers.conf(5)`.  You may also set the
`PODMAN_COMPOSE_PROVIDER` environment variable.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-07-17 13:43:24 +02:00
parent b9383f41ac
commit e596b17fbe
26 changed files with 521 additions and 23 deletions

View File

@ -276,11 +276,12 @@ done
# When rootless use a socket path accessible by the rootless user
if is_rootless; then
DOCKER_SOCK="$WORKDIR/docker.sock"
DOCKER_HOST="unix://$DOCKER_SOCK"
# export DOCKER_HOST docker-compose will use it
export DOCKER_HOST
fi
# export DOCKER_HOST docker-compose will use it
DOCKER_HOST="unix://$DOCKER_SOCK"
export DOCKER_HOST
# Identify the tests to run. If called with args, use those as globs.
tests_to_run=()
if [ -n "$*" ]; then
@ -331,12 +332,12 @@ for t in "${tests_to_run[@]}"; do
trap '. teardown.sh' 0
fi
docker-compose up -d &> $logfile
podman compose up -d &> $logfile
docker_compose_rc=$?
if [[ $docker_compose_rc -ne 0 ]]; then
_show_ok 0 "$testname - up" "[ok]" "status=$docker_compose_rc"
sed -e 's/^/# /' <$logfile
docker-compose down >>$logfile 2>&1 # No status check here
podman compose down >>$logfile 2>&1 # No status check here
exit 1
fi
_show_ok 1 "$testname - up"
@ -354,7 +355,7 @@ for t in "${tests_to_run[@]}"; do
fi
# Done. Clean up.
docker-compose down &>> $logfile
podman compose down &>> $logfile
rc=$?
if [[ $rc -eq 0 ]]; then
_show_ok 1 "$testname - down"