Podman vs. Docker: Comparing the two containerization tools
linode.com
linode.com
I understand some pages need advertising revenue to survive, and that targeted advertising brings in a lot more revenue, but Linode is not a blog, it's a cloud provider valued at almost a billion dollars. They don't need to do this.
A few years ago, I built a website while kind of forgetting how others experience the web. It's lightweight, and eschews ads, newsletter prompts, cookie notices, chatboxes, tracking and all the other annoyances. I didn't think much of it, but a lot of people notice and bring it up when they contact me.
I'm tapping into an undiscovered niche: websites that don't piss people off!
I know them only because their cookie banners often use a layer to block the website, sometimes doesn't load with WebKit on Linux or are slow. I've doubts about a centralized storage of cookie data across different websites.
This is fine. Insight is overrated. However I'm not optimizing for conversions, while Linode probably has professionals doing that full time.
I can't imagine trying to convince my boss to blind the marketing team, especially since the effect is immeasurable by design. I can use Plausible because it doesn't threaten a whole department.
Anyways, that would then need to use a, say, "local storage banner" for most intrusive tracking and we're back to square one.
https://addons.mozilla.org/en-GB/firefox/addon/consent-o-mat...
Though I acknowledge the problem, the user id mapping file is really unfortunate and basically non-portable between systems. I hope there has been better tooling built up around this lately, as Podman basically "wins" over Docker in my book, in all other ways. But the pain required to setup and properly manage user-privileged containers with Podman is just a bit too terse and becomes a significant barrier.
*[edit] to be fair, also a pain with rootless Docker too.
It's an init program — written in Rust — that changes the UID of an account (including home directory) inside the container to match that of the host. It takes care of corner cases such as what happens if there's a conflicting account, or when the user wants to run as root, or when chowning the home directory is too slow, etc.
In a related article I detail why such a program is non-trivial, what all the caveats are that one might have to look out for, and what alternative approaches exist (e.g. bind mounts): https://www.joyfulbikeshedding.com/blog/2021-03-15-docker-an...
https://www.reddit.com/r/podman/comments/103ut7z/comment/j31...
Short summary: My best tip is to see if either "--user $uid:$gid" or "--user 0:0" works together with this command:
podman run --rm --user $uid:$gid --volume ./dir:/dir:Z --userns keep-id:uid=$uid,gid=$gid IMAGE
(requires podman > 4.3.0)
(As an optimization you could it in a rsyncish way)
I tried this k8s https://github.com/lima-vm/lima/blob/f7e7addab557da560da7146... example thinking it'd be a thin wrapper around QEMU.
6gb+ usage RAM with nothing deployed lol
The disconnect to me is weird. I'm pretty sure with qemu-system-aarch64, Debian/Alpine don't use more than 100-200mb of RAM sitting idle. Where does 6GB of RAM usage come from?
Not that I think it's a great use of time to optimize for this whatsoever. I just thought it'd be a fun exercise.
[0] https://www.linuxatemyram.com/
https://github.com/lima-vm/lima/blob/master/examples/default... 4gig default
~$ free -m total used free shared buff/cache available Mem: 3907 304 1446 1 2156 3431 Swap: 0
Thank you.
It looks like Fedora CoreOS inside podman maybe doesn't do this?
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 7.8Gi 212Mi 7.2Gi 8.0Mi 333Mi 7.3Gi
Swap: 0B 0B 0B
And Activity Monitor says that qemu-system-x86_64 is using 1.27GB of real memory.Docker based workflows are rubbish on my MBP.
I think Linux running flawlessly, with full hardware acceleration, all the drivers and equal or close battery life on a MBP would make it the best laptop money could buy. Until that day, it's a ferrari with square wheels
Not sure what you mean by that, hypervisor is what allows the VMs to exist.
Anyway, containers are a Linux thing so I use a Linux laptop when working with containers. No VM is needed and life is great.
Hypervisors are one method of running virtual machines, you also have classical virtualisation methods and when I bring up the virtual machines being slow, I always get someone who pushes up their glasses with an "well actually its a Hypervisor running it, so it's essentially native speed".
I find Linux is a much nicer development environment all around though.
[Edit] Yup, already got one.
What do you mean by “classical virtualisation methods”, actual CPU emulation so you can run e.g. PowerPC on x86?
There is nothing unclear about what I said, I understand that hypervisors are supposed to be fast "almost native speed!". I also know that running Docker/Podman in Linux on MacOS isn't fast for many reasons.
I don't think misnome is trying to be pedantic either, I think we're both unclear as to what you're trying to say.
Edit: I'm also dubious that hypervisors always offer "native" speed. To me this seems like it depends a lot on the hypervisor, the workload, the guest OS, etc.
But anyway prior to that it used VirtualBox (on Mac) if I remember correctly, which is a full virtualisation environment.
Anyway, taking a guess at what you're saying: do you mean full software virtualization vs. hardware-assisted virtualization? If so, I would agree with you that even best-case performance of HA VMs is not quite bare-metal; sometimes it's close enough to not matter much.
Virtualised OS are obviously "slightly" slower because they now don't have 100% of a system to use, and usually require a dedicated chunk of the system RAM, but usually what people actually mean by saying they are slower is because often they don't have direct hardware peripheral access (e.g. their own dedicated network card and disk drives) and the hypervisor emulates some amount of the system. This is the case with the most accessible linux VMs that run docker, because simulating the block devices on top of the MacOS filesystem is slow.
Docker itself is none of these, it's a fancy chroot enabled by linux kernel features, so _requires_ running on top of linux or a sufficiently linux-like compatibility layer.
So you see why it's somewhat incoherent and makes it sound like you are talking out of your ass when you complain that Hyperkit is a hypervisor but "Virtual machines aren't", but all these horrible people keep disagreeing with you.
Currently trialing nix-shell (https://nixos.org/manual/nix/stable/command-ref/nix-shell.ht...) in the iOS team (this team doesn't need to deploy software to servers, so its a small trial for now to make sure certain build tools are useable and on the right version for our build), but see no reason why it couldn't extend to other similar workflows in other teams.
My problem with Nix is, just like Rust, while it provides a very high ROI, the barrier to entry seems very steep; and unlike Rust, the documentation still leaves a lot to wish for. I'd go all-in on it right now, but I'm (rightfully, I guess?) scared of Nix-unique problems that will take 10x the effort to address than the mess that we're currently dealing with.
Tried switching to podman with docker-compose and podman-compose, but can’t get the auth to work for private repos on dockerhub. So basically just accepting my fate of crazy idle memory and cpu usage.
No root cause after 3 years. The best guess is the overhead of IO somewhere in the stack.
- a PHP-fpm container running a 5m LoC codebase - a nodeJS container running a webpack dev server instance on a 1m LoC frontend codebase - 2 elasticsearch containers (one for logs and 1 for for app search) - 2 Kibana container - 1 logstash container - A rabbitmq container - a memcached container - a redis container - a Percona container - 3-4 micro services each in there own container. - an imgproxy container
All of this runs quite snappily in ~6 GB of RAM and I’ve never noticed any slowness while also running Edge, slack, VSCode, PHPStorm, zoom, and a bunch of terminal windows, and I could probably get that down a bit by consolidating the elasticsearch and kibana instances.
It wasn't the only factor though. The lack of options for laptops and inability to self repair drove me away too. Used to be one of the strong points.
The root of the problem is that VM memory is allocated on demand, but never freed after it's used for the first time. In other words, once used, it can never be released. Since my app has a lighter userspace, it starts out using less memory than other VMs, but eventually reaches the memory limit given enough usage and time. (My optimized memory management setup means the VM works well with a lower memory limit than others, but it doesn't solve the fundamental problem.)
Linux has a feature called "page reporting" to report chunks of memory that are no longer used to the hypervisor, which can then drop the to reduce usage on the host side. WSL 2 actually uses this feature, but I suspect it becomes less effective with longer VM uptime because memory becomes more fragmented over time. Since Hyper-V has been limited to dropping contiguous 2 MiB chunks of memory until recently [1], fragmentation is likely the reason many users report high memory usage. Page cache is definitely a contributor as well, but a much easier one to fix. It looks like Microsoft is working on the problem with page reporting.
Although Apple's Virtualization.framework doesn't support page reporting, I was able to implement it with some workarounds and confirmed that this works with QEMU on Linux. Unfortunately, while free memory is correctly reported to macOS, nothing actually seems to get freed. I'm planning to report this to Apple because it seems like memory ballooning (essentially a more limited and primitive version of page reporting) doesn't work as documented, whether it's Virtualization.framework or another VMM like QEMU. If/when Apple fixes this, it'll be possible to reduce memory usage significantly. Details from my investigation into what's going on with memory management on the XNU side: https://twitter.com/kdrag0n/status/1612309883411640321
The good news: From my testing, the issue isn't as bad as it appears. The "free" memory tends to compress quite well, so XNU's memory compression does a good job at taking care of it when you're actually running low on memory.
(Shameless plug on this topic: The app I'm working on already has quite a few improvements over others: fast networking (30 Gbps), VirtioFS and bidirectional filesystem sharing, Rosetta for fast x86, full Linux (not only Docker), lower CPU usage, native Swift UI, and other tweaks. Email in bio for waitlist. Details to avoid spamming this thread: https://news.ycombinator.com/item?id=34374176)
> This feature is powered by a Linux kernel patch that allows small contiguous blocks of memory to be returned to the host machine when they are no longer needed in the Linux guest. We updated the Linux kernel in WSL2 to include this patch, and modified Hyper-V to support this page reporting feature. In order to return as much memory to the host as possible, we periodically compact memory to ensure free memory is available in contiguous blocks. This only runs when your CPU is idle. You can see when this happens by looking for the ‘WSL2: Performing memory compaction’ message inside of the output of the dmesg command.
In defense of Docker (at least it's my impression for why they do things the way they do), you actually want a higher-level abstraction over running a single, specific container, and it starts making sense as you move into a clustering context. Even if you have a basic 2-node cluster, and want to deploy a couple different workloads to it (like some internal webapps, a memcache, a cron job, etc), neither systemd nor any of its direct alternatives give you the necessary tools to "just throw" the workloads at the cluster as a single logical entity. (Of course clusters start getting more interesting again, once you want to deploy stateful things like databases.)
It was incredibly easy. The arguments are exactly the same, so it was just a %s/docker/buildah/g
Images from dockerhub also need to have docker.io/ appended to the front, since buildah doesn't assume dockerhub by default. There is apparently an option for aliases to set a default search namespace but it wasn't important enough for me to dive into.
The downstream ones use Google Jib kicked off by a gradle build for our spring apps.
See screenshot: https://i.ibb.co/NmmytNB/Screenshot-20230209-094632-Firefox....
Per GPTZero on the first few thousand characters https://gptzero.me/:
Average Perplexity Score: 632.205
A document's perplexity is a measurement of the randomness of the text
Burstiness Score: 1089.841
A document's burstiness is a measurement of the variation in perplexity
Its conclusion was "Your text is most likely human written but there are some sentences with low perplexities". There was only one sentence highlighted as possibly written by AI: "However, each tool has its pros and cons."
It's also possible to prompt ChatGPT to write with high perplexity and burstiness, so also decent chance of false negatives.
Also normal etiquette is to quote text that isn't yours. To me, this reflects extremely poorly on the author.
Momentum around Docker that isn't Desktop all but halted in 2018 or so.
I do think the revenue from OpenShift and friends funds Podman/buildah/crun/etc.
crun is Tech Preview in OpenShift 4.12: https://cloud.redhat.com/blog/whats-new-in-red-hat-openshift...
To be fair, I literally use Docker everyday. So I'm not necessarily rooting for its demise. But I'm seemingly happy that innovation is at least coming from somewhere in this space.
Interested in seeing how sticky that revenue is. A big chunk of its value is provided by other free solutions.
A lot of people also don't pay for Docker
Daemonless isn't really relevant to rootless.
containerd/buildkitd/dockerd have been supporting rootless mode too, and lots of rootless codes have been mutually ported over across containerd/buildkitd/dockerd and Podman.
What are the advantage of running Podman over Docker except Podman ecosystem is less mature?
This is basically OK when the containers you want to run are more like traditional daemons. But if you allow normal users to run containers, in a shared multiuser system, you are basically giving them root to do what they want with your system.
e.g. if a normal user can execute a docker container, they can create a mount point for anywhere in your system. They can mount /etc or any other spooky place and be able to read from it like they are root.
This is also potentially bad, for example, if you have a network facing daemon, like a web server. Let's say that you bind mount a directory on the host (because yeah, you want to serve up those static HTML files). The privileges of that container (Apache httpd or whatever) are basically running as root on the host system. Not good.
There are solutions for all this, of course. But this is really where Podman was trying to bring in advantage and added-value over Docker. That and just running as a normal process rather than as a daemon.
Both Docker and Podman support rootless mode (and rootful mode).
One beautiful thing about Podman is it can fire up, pull the image from the container registry, start the container and then go away. Leaving you with only the containerized application running in rootless mode.
To do this with Docker, you fire up the entire Docker infrastructure, then launch the docker client, once the application is up and running, you still need to shut down the docker infrastructure.
Even if you run with podman socket activated server, the podman service will not be running until someone connects to the service, once the connection to the service goes away, the podman service shuts down no longer using system resources.
Podman out the gate has had the facility, which I think it used as a means to distinguish itself. This is great, because maybe that helped push Docker in the right direction.
https://github.com/AkihiroSuda/docker/commit/588a4e91fc8cb99... https://github.com/containers/podman/commit/19f5a504ffb14709...
Rootless Docker wasn't merged/released until Docker 19.03, though , but still it is already nearly 4 years old.
Podman is just an app. It’s like Vim or ffmpeg. Imagine if Vim ran as a root daemon at all times and you ran sudo to connect to it and edit text files in your home directory. That’s how silly the Docker architecture is.
I've been eyeing podman but the additional friction scares me off from jumping in. Has anyone else not doing full-time dev found it (or similar) a simple enough replacement?
(In case someone else also had missed all of that.)
Commercial use of Docker Desktop at a company of more than 250 employees OR more than $10 million in annual revenue requires a paid subscription (Pro, Team, or Business) to use Docker Desktop.
Podman Desktop replaces Docker Desktop.
The only "problem" is that the auto-restart policy doesn't apply between reboots. I kinda get why, and it's not a huge problem for me to start the containers I care about via Podman Desktop when I want to use them. In a sense it works better because if I reboot they all stop and are not using resources.
Here's an article about it: How Colima is a good alternative to Docker Desktop ( https://kumojin.com/en/colima-alternative-docker-desktop/ )
I'm using Colima together with DDEV ( https://ddev.com ) to create and run PHP projects (webserver + db) in containers. Clean, very easy to use, and fast.
Besides there are myriads of other docker gui than docker desktop. Even the non official podman desktop gui can connect to a docker daemon.
https://community.chocolatey.org/packages/docker-engine
https://community.chocolatey.org/packages/docker-cli
So it seems the Docker Inc. enterprise licensing is all based on the "Docker Desktop" UI. Can someone confirm this?
Or if on Linux same as above, but remove the WSL part.
I'm not sure what you are referring to here. I run Docker engine in WSL2, and vscode in Windows. It all seems to work seemlessly to me. What am I missing?
- It calls Docker (docker command) to build and run images
- Visual Studio has an UI to manage containers and images (not sure what it uses under the hood for this)
To recap, I have the following:
Docker (CLI ONLY!!!) on Ubuntu on WSL as described here: https://docs.docker.com/engine/install/ubuntu/
sudo apt list --installed 2>&1 | grep docker
docker-buildx-plugin/kinetic,now 0.10.2-1~ubuntu.22.10~kinetic amd64 [installed,automatic]
docker-ce-cli/kinetic,now 5:23.0.0-1~ubuntu.22.10~kinetic amd64 [installed]
docker-compose-plugin/kinetic,now 2.15.1-1~ubuntu.22.10~kinetic amd64 [installed,automatic]
docker-compose/kinetic,now 1.29.2-2 all [installed]
docker-scan-plugin/kinetic,now 0.23.0~ubuntu-kinetic amd64 [installed,automatic]
python3-docker/kinetic,now 5.0.3-1 all [installed,automatic]
python3-dockerpty/kinetic,now 0.4.1-4 all [installed,automatic]
So I'd say start with installing docker-ce-cli
Rancher Desktop from here:
https://github.com/rancher-sandbox/rancher-desktop/releasesThen in Rancher Desktop you enable WSL integration as shown here: https://imgur.com/a/yKV8S9e
With this done you should be able to have the docker command in Pwsh
I can do docker image ls etc like a full Docker setup!
LXC did this nicely, imho, by storing the state and configuration of each container as files in a directory. It doesn’t seem like LXC/LXD has really taken off (see also: bzr) — bad luck Canonical, but thank you for trying.
Relating to both LXC vs Docker, and Docker vs Podman: oftentimes, the presence of competition is what drives the winner to victory. It might seem like wasted effort to have two competing solutions for a while but the final outcome of a winner that’s better than it would have been is of benefit to everyone. If I had a dollar for every project I started at work just to stone-soup one of my peers into action I would have more than… $20? $50?
Postscript, written after reading the comments below (thanks!): when you need to get a project going in a creative field like software engineering, a useful technique is to start with something — anything at all — announce it, and invite meaningful contributions to take that thing from trivial starting point to a rich and useful product. The analogy is “stone soup”: a villager wants to put together a feast but doesn’t have the means to do it themselves. What they can do is get a fire going, get a pot of water simmering over the fire, and put a single rock in it. They then suggest to another villager “hey I’ve got this soup going but it would be even better with one of your onions: how about we work together?”. To another they say the same thing but for potatoes, to another a ham hock, ad finitum until the pot contains a rich and tasty broth. By kicking off the project, albeit with something that was just a framework, they were able to engage others interest and take the project to completion as a team.
The more scurrilous version of this is shit soup. One villager sets up the pot / asks a question on stackoverflow. Predictably, no one engages. Another villager — secretly conspiring with the first — shows up and announces the correct ingredient to be added next is goat turd / replies to the stackoverflow question with a deliberately incorrect answer. Lo and behold all the other villagers now show up to explain why that answer is dumb, and in fact we should be adding onions, potatoes, and ham / insert correct technical answer to SO question here.
Many of us will have come across this in The Pragmatic Programmer under “Stone Soup and Boiled Frogs”.
When the english first attempted to colonize australia to Australia, an englishman noticed a native 'bush turkey' was not regularly eaten by the local native aboriginals. The englishman had tried to cook and eat them, but it ended up anything but tastey.
He asked one of the tribal elders the secret to eating them, the elder responded.
"You put a stone into the pot, you bring it to boil When its boiling you throw in the plucked bush turkey, you eat it when the stone is soft."
The lesson I take from this is "sometimes things are just going to be bad, you just gotta accept that and move on".
My interpretation of grandparent as applied onto that story was that some of their colleagues had some local solutions that were part of the puzzle and OP purposefully created some ancillary solution (the “stone soup”) to get them to contribute to the bigger picture. But perhaps I’m seeing this entirely wrong?
Maybe for you but LXC is very useful for deploying development environment isolated for each developers. systemd-nspawn is quite simple but LXC provides tooling that makes operations easier.
Docker and LXD serve different purposes. Docker is meant for an app to be run isolated but LXD can run a whole OS.
Checkout `podman run --rootfs`
In either case, whether the container uses a root or user within it isn't really a factor. There's good reasons to assume user permissions within the container, but they have nothing to do with rootless containers: the idea that a regular user can launch a container is a different concept, from the permissions inside the container.
From what I've read, the user running a container really starts to matter when the container is given access to the filesystem (using a volume). It sounds like the user within the container still wouldn't matter in this situation, but the user running the container on the host system would have to have appropriate permissions to the volume.
Honestly, I think the default behavior of rootfull docker is broken by design. Being able to run rootfull docker commands is equivalent to having sudo privileges, because the docker daemon has root privileges and will mount arbitrary files on your behalf.
(I tend to write go and CGO_ENABLED=0, so I typically just pick any user and it doesn't matter. But it can matter in many common cases, so it's worth checking now to save confusion and trouble later. But, it's /etc/passwd that names the user, and filesystem internals that control file access. Typically if a container is designed for nonroot, the relevant files will be owned by the nonroot user they picked. But not always!)
Another FreeBSD solution is Jails. I never seen a more powerful container solution. It is lightweight and has unique features like hierarchical Jails. Management is done over cli or solutions like Iocage. Jails and its ancestors have been developed since 1975. The modern Jails is developed since 1998. It is an incredible flexible and lightweight virtualization platform. Michael W Lucas wrote a very good book about it ("FreeBSD Mastery: Jails").
For starters; Try GhostBSD - FreeBSD with a MATE desktop.
Developers aren't "scared of UNIX". They are scared of things they don't know, and "don't know" in this context means Google search page doesn't explode with results when they search for the thing.
Anecdotally, people in storage business are much more familiar with FreeBSD due to FreeNAS and ZFS in general, but as some of my colleagues who previously worked for Dell EMC "storage division"^* recalled, the second most popular platform they had to adapt their storage solutions for was AIX... (and that trailed far, far behind Linux). It's also funny, in a way, since internally, they often did use FreeBSD in various departments because of FreeNAS. In a similar company, our home directory on dev. server was backed up by FreeNAS (we were also developing a storage product... for Linux).
----
* - There isn't really a "storage division" within Dell EMC afaik, just a bunch of different storage-related projects. I just had to describe those projects in some way.
> In popularity Unix is not the main OS for most developers.
Because of FreeBSD don't want to be helpful? Had idea of Jails but had no resources to make it usable for developers? What's your opinion, knowing FreeBSD backstage?
There are several ways to run Bhyve:
- CLI - Libvert and virt-manager - vm-bhyve
A vm-bhyve template can look like this:
loader="uefi"
graphics="yes"
xhci_mouse="yes"
cpu=2
cpu_sockets=1
cpu_cores=2
memory=4G
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"
disk1_type="ahci-cd"
disk1_dev="custom"
disk1_name="/path/to/disc.iso"
Sample config: https://github.com/churchers/vm-bhyve/blob/master/sample-tem...I use Jails to run applications like Postgres, Redis, Python api in an isolated environment. Jails is native FreeBSD, but isolated.
If you want to understand all of the security features of Podman take a look at chapters 10 and 11 of my book `Podman in Action`.
In the book I also have a nice comparison of features in Podman over Docker.
Podman 4.4 was just released with a new feature called quadlet, which makes running podman containers under systemd really easy. You should see blogs on this very soon.
I would say: A complete security nightmare which make all kind of "smaller" security issues in other places (e.g. IDE) WAY worse and would put docker on a ban-list if the industry really did care about security.
Through then you _can_ setup docker without this vulnerability AFIK it's just not done by default in most setups and I'm not sure how hard it is.
Podman works closely with the HPC (High Performance Computing) world. Checkout the article about how the fastest computers in the world in the most secure facilities in the world are using Podman.
https://www.nersc.gov/assets/Uploads/06-Containers-for-HPC-S...
https://opensource.com/article/23/1/hpc-containers-scale-usi...
Also license and cost aspects.
Like ask 100 devs which have Linux and Docker, I would be surprised if more then 10 made sure that docker _can only run_ without root rights (and there are two ways to do so with different complexity and consequences).
Docker(compose) worked well for me for a long time. I'm chafing a little at the "run as root" problems, so I'm somewhat open to alternatives. I'm also a bit hesitant to relearn or run into problems I don't actually NEED to run into.
podman pod play pod.yaml
I think that’s it. I’m on mobile at the moment.
* last time I used systemd units to manage podman containers, it was an inconsistent failure and a catastrophe with containers failing to start.
* podman-compose is not yet officially supported.
* pods are confusing.
* any use of privileged ports (<1024) requires messing with sysctl values as workaround. yikes!
* no pre-defined apparmor/selinux profiles for common processes.
* folder/file permissions under user namespaces is a confusing mess.
* slirp4netns eats cpu and has awful performance.
* can't do GPU and other deeper HW related tasks.
I could go on and on...
Docker has none of these inadequacies.
Rootless mode works for the great majority of containers, and in most cases users have work arounds for containers that do not work, like binding to ports < 1024. But I agree that understanding these limitations, sometimes requires users to learn new things.
But Security often requires compromise, we don't run all processes as root for a reason in Linux.Running processes with privilege mode by default is way more secure.
It's called the Operating System.(obviously i am talking about production not development).
In these things I'm a bit helpless judging the cost vs benefit ratio.
Checkout https://www.stackrox.io/blog/the-runc-vulnerability-a-deep-d...