23

I recently found out about Podman (https://podman.io). Having a way to use Linux fork processes instead of a Daemon and not having to run using root just got my attention.

But I'm very used to orchestrate the containers running on my machine (in production we use kubernetes) using docker-compose. And I truly like it.

So I'm trying to replace docker-compose. I will try to keep docker-compose and using podman as an alias to docker as Podman uses the same syntax as docker:

alias docker=podman

Will it work? Can you suggest any other tool? I really intend to keep my docker-compose.yml file, if possible.

tgogos
  • 16,343
  • 14
  • 77
  • 108
otaviofcs
  • 675
  • 2
  • 5
  • 16

2 Answers2

21

Yes, that is doable now, check podman-compose, this is one way of doing it, another way is to convert the docker-compose yaml file to a kubernetes deployment using Kompose. there is a blog post from Jérôme Petazzoni @jpetazzo: from docker-compose to kubernetes deployment

Walid
  • 679
  • 9
  • 15
  • 1
    Thank you @walid! Quite new this one. But it seems to do the trick. Kompose it's helpful as well. Adopting kubernetes as the "de facto" standard helps you move faster into production. I'll try both. Best regards! – otaviofcs Mar 19 '19 at 11:04
  • Hello, @otaviofcs I have added Jérôme Petazzoni blog reference. I hope these are enough to get you going ;-) – Walid Mar 19 '19 at 19:07
  • 2
    Note that there are many docker-compose commands which are incompatible with podman-compose, which is unfortunate: https://github.com/containers/podman-compose/issues – Régis B. Sep 21 '20 at 08:17
  • true @RégisB. however for simple cases, you might just use podman, check out latest article regarding moving from compose to podman https://www.redhat.com/sysadmin/compose-podman-pods – Walid Sep 23 '20 at 18:56
7

Podman 3.0 (released in February 2021) introduced support for the standard docker-compose. Podman now supports the Docker REST API well enough to be able to serve the needs of docker-compose. Podman can listen on a UNIX domain socket or a TCP socket that docker-compose connects to (instead of to the Docker daemon).

Two notable caveats though

  • Running Podman as a normal user (rootless) does not yet work (See feature request)

  • The functionality relating to Swarm is not supported.

To enable Podman as the back-end for docker-compose, run as root

 systemctl enable --now podman.socket

Podman will then listen on the UNIX domain socket /var/run/docker.sock that docker-compose uses by default.

If you would like to specify the details of the socket yourself, use podman system service and set the environment variable DOCKER_HOST for docker-compose, for instance

podman system service --time 0 unix:/some/path/podman.sock

and in another shell

export DOCKER_HOST=unix:///some/path/podman.sock
docker-compose up -d

See also:

Mark Stosberg
  • 11,351
  • 6
  • 37
  • 47
Erik Sjölund
  • 9,109
  • 7
  • 34
  • 60
  • Thank you for improving the answer. When can update when it's production ready – otaviofcs Jan 12 '21 at 03:04
  • Well, I think it is a drawback to be required to run podman in root mode to support docker-compose. Why didn't redhat continue investing on podman-compose? – Bruce Sun Feb 03 '21 at 09:08