podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

podman-system-service and docker-compose

Open khimaros opened this issue 5 years ago • 2 comments

podman-system-service provides docker compatible API. this may be a path to full support of docker-compose with podman.

this is what works:

# apt install podman

# systemctl start podman

# apt install --no-install-recommends docker-compose

# which docker || echo "no docker installed"
no docker installed

# cat docker-compose.yml
hello-world:
  image: hello-world

# docker-compose -H unix:/run/podman/podman.sock pull
pulling hello-world ... done

# docker-compose -H unix:/run/podman/podman.sock up
Creating hello_hello-world_1 ... done
hello-world_1  | Hello from Docker!
hello_hello-world_1 exited with code 0

# podman ps -a
<shows exited container>

i've verified that this works with podman 2.0.6 and docker-compose 1.25.0 on debian bullseye.

of course, one of the appeals of podman is being able to run unprivileged. partial success:

$ systemctl start --user podman

$ docker-compose -H unix:/$XDG_RUNTIME_DIR/podman/podman.sock pull
pulling hello-world ... done

$ docker-compose -H unix:/$XDG_RUNTIME_DIR/podman/podman.sock up
ERROR: ... invalid configuration, cannot specify resource limits without cgroups v2 and --cgroup-manager=systemd

the pull was successful, and the socket is working fine:

$ podman -r images
REPOSITORY                     TAG     IMAGE ID
docker.io/library/hello-world  latest  bf756fb1ae65

$ podman -r run --rm -ti hello-world
Hello from Docker!

launching the system service with --cgroup-manager=systemd or --cgroup-manager=cgroupfs has no impact.

possibly related to https://github.com/containers/podman/issues/5903

khimaros avatar Dec 10 '20 04:12 khimaros

eureka! running as unprivileged user is now working.

the missing link was booting the kernel with systemd.unified_cgroup_hierarchy=1

khimaros avatar Dec 10 '20 05:12 khimaros

i've written up a short tutorial here: https://khimaros.com/articles/docker-compose-podman/

khimaros avatar Dec 10 '20 05:12 khimaros