Docker Compose With Podman

Podman is a container engine that enables users to manage OCI-compliant containers on Linux systems without the need for a daemon. It is popular among users as an alternative to Docker due to its ease of adoption. However, the lack of support for Docker Compose, a command-line tool that coordinates multiple Docker containers for local development, has been a major concern for many users and the container community. Podman starts to support docker-compose from version 3.0 but changes in docker-compose from version 2.0 made some incompatibilities, so a community project called Podman Compose has been born. Podman Compose processes the Compose spec and translates it into Podman CLI commands [1].

There are many articles that you can read about Podman vs Docker, but here I am going to share an experience to run Docker-compose with Podman. In the telecom field, many operators are using Red Had Linux (rhel 8 or 9) and Red Hat uses Podman because it is designed to be a more secure and efficient alternative to Docker.

Podman runs without the need for root privileges, which reduces the risk of security vulnerabilities caused by running containers with elevated permissions. Also, Podman is natively integrated with Red Hat’s container orchestration platform OpenShift, which makes it easier to deploy and manage containerized applications at scale.

Overall, Podman’s security, performance, and integration features make it a good fit for Red Hat’s container orchestration platform and their enterprise customers who are looking for a more secure and efficient solution to run containers. So, what if you need to use Docker-compose and re-use your YAML??

To use Podman with Docker-compose, I did some tricks. So far, I have not encountered any issues, but I will update if something goes wrong.

You need to follow below steps:

These are the version of OS and Podman which I used:

1
2
3
4
5
root@rhel:~# uname -a
Linux rhel 5.14.0-162.6.1.el9_1.x86_64

root@rhel:~# podman -v
podman version 4.2.0

Then I run:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
root@rhel:~# yum update -y

root@rhel:~# yum install podman-docker -y

root@rhel:~# curl -L https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

root@rhel:~# chmod 755 /usr/local/bin/docker-compose

root@rhel:~# docker-compose -v
Docker Compose version v2.3.3

root@rhel:~# touch /var/run/docker.sock
root@rhel:~# mount --bind /var/run/podman/podman.sock /var/run/docker.sock

I tried with different version of Docker-compose, but among versions > 2, v2.3.3 seems ok with Podman.

[1] https://www.redhat.com/sysadmin/podman-compose-docker-compose

updatedupdated2023-01-212023-01-21