3

I know that we need to install the podman-docker package from RPM to use Docker Compose in Redhat systems.

But such a package is not available on the Ubuntu system in the APT. Then how can I run a Docker Compose file?

Avik
  • 371
  • 4
  • 15

1 Answers1

7

The package podman-docker is not used when running docker-compose together with Podman. .

Some notes about the RPM package podman-docker

The RPM package podman-docker provides a wrapper shell script so that executing docker will actually execute podman.

$ cat /etc/fedora-release 
Fedora release 34 (Thirty Four)
$ rpm -ql podman-docker | grep bin
/usr/bin/docker
$ file /usr/bin/docker 
/usr/bin/docker: a /usr/bin/sh script, ASCII text executable
$ cat /usr/bin/docker
#!/usr/bin/sh
[ -f /etc/containers/nodocker ] || \
echo "Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg." >&2
exec /usr/bin/podman "$@"
$ 

This functionality is not needed when running docker-compose with Podman. Instead the environment variable DOCKER_HOST is used to configure what backend docker-compose will connect to. Podman understands the Docker REST API and can be used as a backend for docker-compose.

Running docker-compose with Podman on Ubuntu

(Untested instructions as I don't have an Ubuntu system)

  1. Install the executable docker-compose

    curl -sL -o ~/docker-compose https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)
    chmod 755 ~/docker-compose
    
  2. Run

    systemctl --user start podman.socket
    

    (Remove --user when running as root)

  3. Set the environment variable DOCKER_HOST

    export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
    
  4. Run

    ~/docker-compose up -d
    

You could also skip installing the docker-compose executable and instead run docker-compose in the container docker.io/docker/compose

For more details see my answer https://stackoverflow.com/a/65670037/757777

Ubuntu 21.04 has Podman 3.0.1. The package contains this list of files: https://packages.ubuntu.com/hirsute/amd64/podman/filelist

For instance

  • /lib/systemd/system/podman.service
  • /lib/systemd/system/podman.socket
  • /usr/lib/systemd/user/podman.service
  • /usr/lib/systemd/user/podman.socket

These files are needed for systemctl --user start podman.socket and systemctl start podman.socket to work.

Note, Podman 3.0.1 only supports docker-compose when Podman is run as root.

The coming release Ubuntu 21.10 scheduled for October 2021 currently contains Podman 3.2.1. Podman 3.2.1 supports running docker-compose when Podman is run as a normal user (i.e. running rootless).

I would guess that 21.10 will be a safer bet to get Podman working with docker-compose. An alternative could be to install a newer Podman version from the 3rd party repository Kubic.

https://podman.io/getting-started/installation

Erik Sjölund
  • 10,690
  • 7
  • 46
  • 74