this post was submitted on 11 May 2025
31 points (94.3% liked)

Selfhosted

46677 readers
996 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I'm not really sure where the right place to ask is, but I figure this is a good place for docker related questions.

I have recently installed Bazzite as my daily driver, previously I was on Nobara. The main difference here is that Bazzite is immutable, so you can't (or shouldn't) install stuff in the normal way as it may get overwritten by updates.

I have a bunch of docker compose YAML files. I want to run these locally. But I also don't want to tweak anything in the files to get them running because they should be able to be copied to a prod environment as is or the local test environment isn't a good test. Prod would be either my Linux Mint server or an Ubuntu Server one.

Bazzite has a ujust script available for installing docker, but this doesn't include docker compose, and I'm not sure how to add that in.

Searching online shows everyone saying just use podman, it comes pre-installed and is a drop in replacement. The problem is that it doesn't work.

Maybe that's my question, why isn't my compose.yaml working with podman?

For example, the container gives me a bunch of messages about missing environment variables, but they are set in the compose.yaml.

I also get a bunch of permissions errors. E.g. here is the mariadb trying to access a directory and then trying to change the ownership:

[db]         | find: ‘/var/lib/mysql/’: Permission denied
[db]         | chown: changing ownership of '/var/lib/mysql/': Permission denied

Volumes are all bind mounts. After the container created the local directories, I set all the permissions to 777 as a test and took the containers down then up and it still complains about permissions.

I feel like there is something specific to podman or Bazzite I'm not understanding. Any help?

I'm also happy to take suggestions on other ways to use docker compose in Bazzite.

Thanks in advance!

Edit: I have solved this by adding a Z flag to my bind mounts (./localdir:/containerdir:Z) as per this answer.

top 20 comments
sorted by: hot top controversial new old
[–] tkw8@lemm.ee 9 points 19 hours ago (2 children)

I wonder if SELinux is the culprit here. Bazzite is based on Fedora, right (like Nobara)?

[–] SNThrailkill@techhub.social 4 points 19 hours ago (1 children)

@tkw8 @Dave if I'm not mistaken Bazzite has Podman enabled by default. No Docker. So you can use "podman compose" as a replacement for "docker compose" and it should "Just Work"

[–] Dave@lemmy.nz 3 points 19 hours ago (1 children)

I mentioned this in my original post.

Searching online shows everyone saying just use podman, it comes pre-installed and is a drop in replacement. The problem is that it doesn’t work.

But someone else has mentioned the issue is the containers are rootless by default, so I'll explore that line of troubleshooting.

[–] SNThrailkill@techhub.social 0 points 19 hours ago (1 children)

@Dave if not, I recommend checking out distrobox which comes pre installed and should be able to achieve what you want

[–] Dave@lemmy.nz 4 points 18 hours ago

Thanks, I had already played a bit with distrobox and hadn't worked that out either. It seems adding a Z flag to my bind mount to keep SELinux happy is all that was needed.

[–] Dave@lemmy.nz 1 points 19 hours ago* (last edited 19 hours ago)

I was running Nobara before, which is also based on Fedora, so not sure why it would be different in regards to SELinux?

[–] giacomo@lemm.ee 8 points 19 hours ago (1 children)

when I moved my docker setup to a fedora coreos podman setup, the volume mounts required an additional option for a label to play nice with selinux. 'z' if the mount is shared between multiple containers and 'Z' if its just for one container.

the podman docs definitely go into more details.

ive also seen people talk on the discord about scripts that can take your yaml files and write container files to be used with podman-systemd that seemed pretty nice. i think there is also a podman-compose option out there, but I'm not super familiar with that.

[–] Dave@lemmy.nz 2 points 19 hours ago (1 children)

Oh shit I think that's it! I've added that Z flag to each bind mount declaration in compose.yaml, and it seems to be running properly now. Thanks!

Any idea what the implications are of this transferring to an ubuntu based distro?

[–] giacomo@lemm.ee 2 points 15 hours ago* (last edited 15 hours ago) (1 children)

im not sure about ubuntu based distros. without selinux, you may not need the extra option on the volume mount.

[–] Dave@lemmy.nz 1 points 14 hours ago

Ok thanks, I'll have to be extra careful deploying any changes.

[–] SabMayaHai@lemmy.ml 3 points 17 hours ago* (last edited 17 hours ago) (1 children)

Glad you figured it out! One more nuance I discovered, there is a difference between podman-compose and podman compose The latter is equivalent to using docker compose Also in terms of community, their Discord (if you're okay with using it) is quite responsive

[–] Dave@lemmy.nz 1 points 16 hours ago

Thanks! I did see there's a docker format and a podman format which I assume is what this difference is about. I'm not against discord but I've never really used it. I'll check it out if I get desperate 🙂

[–] cecilkorik@lemmy.ca 3 points 19 hours ago (3 children)

Podman runs rootless containers, this means their permissions do not work like docker, and it is not in fact a drop-in replacement for docker as you've discovered. The rootless containers are the key difference. You could try to run a rootful container instead, or if you read this thread by someone encountering the same issue as it sounds like you are running into including using mode 777 maybe their comment later on with the solution for them might help you too. But yes, podman is not exactly a drop-in replacement for docker in my experience. It is quite different, though mostly compatible.

[–] dan@upvote.au 1 points 13 hours ago

this means their permissions do not work like docker, and it is not in fact a drop-in replacement for docker

It might a drop-in replacement for Docker if you're running Docker in rootless mode? Not sure how common that is, though.

[–] Dave@lemmy.nz 1 points 19 hours ago* (last edited 19 hours ago)

As far as I can tell, you just run the command with sudo to run as root? But this doesn't help, I have been using sudo.

Edit: I think this is solved, someone else mentioned using the Z flag on the bind mount declaration and it seems to be working!

[–] Dave@lemmy.nz 1 points 19 hours ago

Thanks, I will have a go at trying to get it running as a rootful container!

[–] just_another_person@lemmy.world 0 points 19 hours ago (1 children)

It's an immutable distro, so the regular locations on the filesystem are all read-only. The only way you can do this is making sure you mount separate storage, or use the userspace home mount or whatever they call it. It's trivial to move the docker dir to wherever, so just do that.

[–] Dave@lemmy.nz 1 points 19 hours ago (1 children)

I'm already using bind mounts under the /home directory. I learnt pretty early on day 1 not to fight the distro, so I'm trying to understand the way Bazzite wants this to be done. From another reply, it sounds like it's a difference in rootless/rootful containers so I'm going to try to work out how to run a podman container as root and see if this helps.

[–] just_another_person@lemmy.world 2 points 19 hours ago (1 children)

No, it's the difference between your docker service knowing it's datadir isn't in /var/lib and not.

Shut down docker. Create a datadir in your writeable mount, change the docker configs to point to the new location, and restart.

Here's an example: https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

[–] Dave@lemmy.nz 2 points 19 hours ago

I seem to have got it working using podman, adding a Z flag to the bind mount to make SELinux happy.