Using Podman, Compose and BuildKit

(emersion.fr)

167 points | by LaSombra 6 hours ago ago

36 comments

  • jabl 4 hours ago ago

    If you're not wedded to docker-compose, with podman you can instead use the podman kube support, which provides roughly docker-compose equivalent features using a subset of the Kubernetes pod deployment syntax.

    Additionally, podman has nice systemd integration for such kube services, you just need to write a short systemd config snippet and then you can manage the kube service just like any other systemd service.

    Altogether a very nice combination for deploying containerized services if you don't want to go the whole hog to something like Kubernetes.

    • GCUMstlyHarmls 4 hours ago ago

      (I'm a big podman stan)

      Last I tried using the .kube files I ran into issues with specifying container networks (https://github.com/containers/podman/issues/12965).

      This is sort of "fixed" by using a Quadlet ".kube" but IMO that's a pretty weak solution and removes the "here's your compose file, run it" aspect.

      Recently (now that Deb13 is out with Podman 5) I have started transitioning to Podmans Quadlet files which have been quite smooth so far. As you say, its great to run things without all the overhead of kubernetes.

      • teekert 4 hours ago ago

        "...removes the "here's your compose file, run it"

        Claude recently hallucinated this for me:

            [Container]
            ComposeService=my-service
            Yaml=/path/to/your/podman-compose.yaml 
        
        For a brief moment in time I was happy but then:

        Can you really use "ComposeService" in the systemd unit file? I can't find any reference to it

        You're absolutely right to question that - I made an error. There is no ComposeService directive in systemd or Quadlet.

        It would be a nice best of both worlds...

    • depingus 3 hours ago ago

      > you just need to write a short systemd config snippet and then you can manage the kube service just like any other systemd service.

      Just FYI, `podman generate systemd --files --name mypod` will create all the systemd service files for you.

      https://docs.podman.io/en/latest/markdown/podman-generate-sy...

      • justusthane 3 hours ago ago

        `podman generate systemd` was created as a bandaid because it was so difficult to manually write systemd units.

        Quadlets now make it much easier to create the units by hand, and ‘ `podman generate systemd` is deprecated.

      • klysm 2 hours ago ago

        Echoing the other comment that quadlet is the way to go here

    • 3abiton 2 hours ago ago

      I am curious performance wise about the performance difference between podman and incus. I found incus to be also extremly flexible.

      • seabrookmx 30 minutes ago ago

        They both utilize all the linux c-group magic to containerize. So performance is roughly the same.

        Incus is an LXD fork, and focuses on "system" containers. You basically get a full distro, complete with systemd, sshd, etc. etc. so it is easy to replace a VM with one of these.

        podman and docker are focused on OCI containers which typically run a single application (think webserver, database, etc).

        I actually use them together. My host machine runs both docker and incus. Docker runs my home server utilities (syncthing, vaultwarden, etc) and Incus runs a system container with my development environment in it. I have nested c-groups enabled so that incus container actually runs another copy of docker _within itself_ for all my development needs (redis, postgres, etc).

        What's nice about this is that the development environment can easily be backed up, or completely nuked without affecting my host. I use VS Code remote SSH to develop in it.

        The host typically uses < 10GB RAM with all this stuff running.. about half what it did when I was using KVM instead of Incus.

      • esseph an hour ago ago

        These seem like two very different stacks designed to solve quite different problems (incus v podman)

    • iTokio 4 hours ago ago

      Isn’t that limited to a single node?

      How would you configure a cluster? I’m trying to explore lightweight alternatives to kubernetes, such as docker swarm, but I think that the options are limited if you must support clusters with equivalent of pods and services at least.

      • jabl 2 hours ago ago

        > Isn’t that limited to a single node?

        Yes. Though unless you have a very dynamic environment maybe statically assigning containers to hosts isn't an insurmountable burden?

      • sc68cal 2 hours ago ago

        > How would you configure a cluster?

        So, unless you have a service that requires a fixed number of running instances that is not the same count as the number of servers, I would argue that maybe you don't need Kubernetes.

        For example, I built up a Django web application and a set of Celery workers, and just have the same pod running on 8 servers, and I just use an Ansible playbook that creates the podman pod and runs the containers in the pod.

      • gf000 3 hours ago ago

        In the off chance your search didn't expand to k3s, I can semi-recommend it.

        My setup is a bit clunky (having a Hetzner cloud instance as controller and a local server as a node throught Tailscale), from which I get an occasional strange error that k3s pods fail to resolve another pod's domain without me having to re-create the DNS resolver system pod, and that I so far failed at getting Velero backups to work with k3s's local storage providers, but otherwise it is pretty decent.

        • iTokio 3 hours ago ago

          K3s is light in terms of resources, but heavy in operational complexity, I’m not looking for a smaller version of kubernetes but for a simple way to run container backed services when you’re not google but a small company, something that has few moving parts but is very reliable and low maintenance.

          • esseph an hour ago ago

            I've been back and forth on this for a long time, but I've just decided at this point that I either settle for podman or docker on a single host, or go to Talos / k3s / k8s. There's a lot of tools there, a lot of inertia, and eventually it's likely that I will need to solve the problems that k8s does.

            YMMV

      • zelphirkalt 2 hours ago ago

        I once tried Nomad for a very brief moment. Not sure if it fits your bill.

  • heavensteeth 2 hours ago ago

    I tried Podman on my messing around VPS but quickly reverted to rootless Docker.

    The straw that broke the camels back was a bug in `podman compose` that funnily enough was fixed two hours ago[1]; if `service1` has a `depends_on` on `service2`, bringing down `service1` will unconditionally bring down `service2`, even if other services also depend on it. So if two separate services depend on a database, killing one of them will kill the database too.

    Another incompatibility with Docker I experienced was raised in 2020 and fixed a few months ago[2]; you couldn't pass URLs to `build:` to automatically pull and build images. The patch for this turned out to be a few lines long.

    I'm sure Podman will be great once all of these bugs are ironed out, but for me, it's not quite there yet.

    [1]: https://github.com/containers/podman-compose/pull/1283

    [2]: https://github.com/containers/podman-compose/issues/127

    • bogwog an hour ago ago

      Podman compose is an attempt to court Docker users by porting over a bad idea. Instead of that, learn how to create "quadlets" and you'll never want to touch docker again. See: https://www.redhat.com/en/blog/quadlet-podman

      I recommend starting with .container files instead of .kube, unless you're already familiar with kubernetes.

  • lukaslalinsky 2 hours ago ago

    I was a huge fan of Podman, but I eventually gave up and use Docker Compose for local development. It's not worth fighting the system.

    However, for single server deployments, where I don't need Kubernetes, I now exclusively use Quadlets to run apps and I couldn't be happier. It's a much nicer experience that using typical Docker/Podman setup. It feels integrated into the system.

  • rsyring 40 minutes ago ago

    I've wanted to try Podman for a couple years. But I keep bowing out because there are no official Ubuntu builds that I could find. Upstream seems content with that status quo.

    That's their prerogative, and I could build it myself, but it makes me concerned they don't really have multi-distro compatibility as a priority, which makes me hesitant to commit time to experimenting with it when Docker considers Ubuntu a first-class citizen.

  • smjburton 3 hours ago ago

    This is an interesting find OP and could help people transition from Docker to Podman (especially if they're used to deploying with Docker-Compose).

    I think the better long-term approach though is to use systemd user units for deployment, or the more modern approach of using Podman Quadlets. There's a bit of a learning curve, but these approaches are more native to the Podman platform, and learning how systemd services work is a great skill to have.

  • mstade 4 hours ago ago

    I replaced my Docker usage entirely with OrbStack[1] a few months ago, and have had zero issues with it so far. Great product that I happily pay a license for.

    My usage is fairly basic though and I'm sure mileage varies, but for my basic web dev setup it's been perfect.

    [1]: https://orbstack.dev/

    • jFriedensreich 3 hours ago ago

      orbstack is just a vm provider for docker on mac, colima offers the same features without a ui and is a great open replacement but as neither supports podman both are not really relevant to the podman discussion.

      • epistasis 2 hours ago ago

        The UI of OrbStack is probably one the biggest features, so a replacement without the UI doesn't make a ton of sense for most people that like OrbStack.

      • nicce 3 hours ago ago

        > orbstack is just a vm provider for docker on mac

        ”just” is a big statement here. Performance between colima and OrbStack are from different planets.

        Apple just released their own runtime so that is also worth inspecting.

        • jFriedensreich 2 hours ago ago

          can you back that claim up? i see a huge difference between orbstack and docker desktop but colima and orbstack use afaik the same technology and the performance was near identical in my tests. (Though you need to change the colima settings to vz and virtiofs)

  • gz09 3 hours ago ago

    Unfortunately, it's quite a big mess (as the article indicates), which leads to a steep learning curve for someone who "just wants to build some images".

    And that's just half of it. Want to build an image on two native architectures (ARM64 and AMD64) and then make a multi-arch image out of them. Might blow someones mind on how complicated that is with 2025 docker technologies: https://docs.docker.com/build/ci/github-actions/multi-platfo...

  • zoobab an hour ago ago

    I use a special feature of Docker Buildx with a multistage Dockerfile build, with the SDK in the first part, and an empty container in the second part to copy the build artifact (like firmware.bin), like explained here:

    https://docs.docker.com/build/building/export/

    Does Podman supports the same feature?

  • lloydjones 4 hours ago ago

    I encountered this exact issue (no buildkit with Podman) months ago. I gave up and used Docker desktop, but I'm glad you didn't. Well done!

  • cyprien_g 5 hours ago ago

    I have never used Podman, but I hear about it very often. I currently use Colima (https://github.com/abiosoft/colima) and I'm very satisfied with it.

    I have tried to find a good comparison between the two, but I find it hard to have a clear opinion on which one is best for me.

    • cmiles74 5 hours ago ago

      I use Podman, I wanted a Docker-like experience on MacOS or Windows. I use it to provide services during development (PostgreSQL, etc.) and working on image builds. It works pretty well. :-)

    • rockyj 5 hours ago ago

      Colima is related but separate, Colima runs a Linux VM seamlessly in MacOS so you can interact with Docker as if it was running on your host OS. Podman will also need a VM (coz there is no native Docker on MacOS).

      • dizhn 4 hours ago ago

        That sounded like podman needs docker. It's more of a mostly compatible separate product that does not need a daemon to run. Both probably lack things like cgroups (a Linux kernel really) etc on macos.

      • privatelypublic 4 hours ago ago

        Podman Desktop uses a VM on windows too.(WSL2)

  • haolez 4 hours ago ago

    But Docker can run rootless these days, right? Can anyone chime in with how well does this work?

    • pxc 4 hours ago ago

      Actually setting up rootless Docker is pretty manual and kludgy. With Podman, rootless is pretty much effortless.