diff --git a/Dockerfile-compose b/Dockerfile-compose new file mode 100644 index 0000000..2e177fe --- /dev/null +++ b/Dockerfile-compose @@ -0,0 +1,3 @@ +ARG BASEIMAGE +FROM ${BASEIMAGE} +RUN apk add --no-cache curl docker-compose diff --git a/Makefile b/Makefile index a83f84e..3b0a7db 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,10 @@ podman-remote: podman-ssh: podman $(DOCKER) build --force-rm -t $(PODMAN_SSH_IMAGE) -f Dockerfile-ssh --build-arg BASEIMAGE=$(PODMAN_IMAGE) . -test: test-local-rootless test-local-rootful test-minimal-image podman-remote +podman-compose: podman + $(DOCKER) build --force-rm -t $(PODMAN_COMPOSE_IMAGE) -f Dockerfile-compose --build-arg BASEIMAGE=$(PODMAN_IMAGE) . + +test: test-local-rootless test-local-rootful test-local-rootless-docker-compose test-minimal-image podman-remote test-local-rootful: podman storage-dir IMAGE=$(PODMAN_IMAGE) ./test/test-local-rootful.sh @@ -37,6 +40,12 @@ test-local-rootful: podman storage-dir test-local-rootless: podman storage-dir IMAGE=$(PODMAN_IMAGE) ./test/test-local-rootless.sh +test-local-rootless-docker-compose: podman-compose + $(DOCKER) run --rm --privileged -u podman:podman \ + --mount "type=bind,src=`pwd`/test/test-rootless-compose.sh,dst=/test-rootless-compose.sh" \ + $(PODMAN_COMPOSE_IMAGE) \ + /bin/sh -c /test-rootless-compose.sh + test-minimal-image: podman-minimal storage-dir IMAGE=$(PODMAN_MINIMAL_IMAGE) TEST_PREDICATE=MINIMAL SKIP_PORTMAPPING_TEST=true ./test/test-local-rootless.sh diff --git a/test/test-rootless-compose.sh b/test/test-rootless-compose.sh new file mode 100644 index 0000000..cdee3fd --- /dev/null +++ b/test/test-rootless-compose.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +echo +echo TEST DOCKER-COMPOSE IN PODMAN +echo + +set -eu + +cat < /tmp/docker-compose.yml +version: "3" + +services: + reverse-proxy: + image: traefik:v2.4 + command: --api.insecure=true --providers.docker + ports: + - "80:80" + - "8080:8080" + volumes: + - /tmp/podman.sock:/var/run/docker.sock + + whoami: + image: traefik/whoami + labels: + - "traefik.http.routers.whoami.rule=Host(\`whoami.docker.localhost\`)" + - "traefik.http.services.whoami.loadbalancer.server.port=80" +EOF + +podman system service --time 0 unix:///tmp/podman.sock & +sleep 5 +docker-compose -H unix:///tmp/podman.sock -f /tmp/docker-compose.yml up -d +sleep 5 +curl -H "Host:whoami.docker.localhost" http://127.0.0.1