Docker in Fedora 39

I haven’t been using Fedora for a few years but wanted to try it again (Fedora 39). In the past, I had a few problems with Docker in Fedora (see Fixing Docker problems in Fedora). Things are slightly improved, while others haven’t changed. For sure, I gave up using the official Docker command in Fedora: I’m using “moby-engine” instead of “docker-ce” and also “docker-compose“. In the past, Moby was mostly working out of the box, while Docker CE required a few tweaks. I don’t think it’s worthwhile insisting on tweaking it, so I’ll go straight with Moby.

This is a docker-compose file that gave me troubles in the past in Fedora:

Save it to “docker-compose.yaml” and run “docker-compose up,” and it works fine! (In the past, with Docker CE, this used to hang and eat all the memory).

Concerning the Testcontainers library, I’ll use this example project (taken from my TDD book): https://github.com/LorenzoBettini/it-docker-mongo-example. I run “mvn verify”.

When it comes to using Testcontainers, I get this error:

However, the error goes away if I update Testcontainers to a more recent version (previously, I was using 1.16.3):

So, that works!

Let’s try now by telling Docker to use another folder (for the images and containers) on another disk.

First, stop Docker

Then, change this file (remember, I’m using “moby-engine”, which uses this file with these contents) “/etc/sysconfig/docker”:

I’m adding this last line to point to a directory that mounts a partition on another disk:

And let’s reload Docker

Now, the “docker-compose.yaml” file above gives this error:

And the Maven project above fails with something like that:

This problem is due to SELinux (that figures!!!) If you temporarily disable SELinux:

Everything succeeds again!

Thus, Moby in Fedora 39 works out of the box with the default configuration. If you want images and containers in another mounted directory (not handled by Selinux), you must disable SELinux.

Better than nothing! 😉

2 thoughts on “Docker in Fedora 39

  1. Bret Bernhoft

    This is a timely article, as I have a Fedora box sitting, waiting to be used for just this purpose. You mention in your article that Moby work in Fedora right out of the box. How would you accomplish the same thing on Ubuntu?

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.