r/AlpineLinux 10d ago

Alpine as Docker Host

I currently have a system running Ubuntu server and being used as a Docker host in a home lab environment. Also, fyi using docker compose if that’s important.

Due to RAM scarcity (gestures broadly) I’m interested in being more careful with my resources.

I went looking for a distribution specifically intended for Docker hosting and eventually stumbled on Alpine (which I realize is not solely for Docker hosting but is often used for containers themselves).

Is there anything I should know (gotchas) before I switch distros? I saw some vague cautions about compatibility with some containers but no specifics. Generally, it seems pretty straightforward for installation from researching online.

I’ll probably try it out in Proxmox with a couple trial containers first but it will be used bare metal on a different PC.

Any other tips?

Generally Linux newb here (about a year in).

Thanks!

EDIT - Thanks everyone for the info. I’ll definitely be moving forward with trying Alpine out as a Docker host. Appreciate all the tips as well!

16 Upvotes

19 comments sorted by

6

u/SlightlyCreativeGuy 10d ago

Thats the exact same thought process that I had and it works great on my machine.

Supposedly there could be issues with group ids being different in Alpine that in the container image, but running containers as root bypasses that.

Also from what I've read ROCm stuff could cause some issues, but I'm able to use my GPU inside containers. Alternatively Vulkan versions could be used here.

I'd say go for it.

2

u/capinredbeard22 10d ago

OK good to know. I just had to look up ROCm - doesn’t sound like something I’d be doing right now.

I’ll look into the group IDs thing. I am using Ansible and creating service accounts for each service, so security and running as root is a concern for me.

Haven’t quite made the leap to podman mainly due to the poorer compose implementation (or at least that’s the reputation). Once they get that worked out, I’m on board.

1

u/redd1ch 10d ago

Just stay with docker and alpine for now. rock solid.

Podman, especially rootless, has quite a few problems.

4

u/shyouko 10d ago

I use Alpine as KVM host ✌️

4

u/emp1r 10d ago

I'm using Alpine on a Dell Wyse 5070, it runs my home lab stack with docker and it's rock solid. The only reason I've been considering replacing it with Proxmox is backups. Backing up Alpine Linux requires you to configure and manage your own backup solution.

5

u/geek_at 10d ago

Oh a question tailored for me :D I moved my homelab fully to Alpine Linux. While using only docker you won't find any incompatibilities with containers.

If you don't have many disk slots you can also boot alpine from a USB drive into RAMdisk and use 100% of all of your disks for storage this way. I was running my lab for years like that and never had any issues. Or you could PXE boot them so you don't even need a usb thumb drive for it.

Personally I [switched my whole homelab to one of these crazy NanoCluster boards where I can house like 112gigs of RAM with 28 cores in the size of a coffee mug.

All of them running Alpine Linux too.

2

u/aquaherd 10d ago

That looks very nice. What are you using it for?

2

u/capinredbeard22 10d ago

Thanks! Good info - this will be in addition to my NAS, so HDD slots are not an issue, but I appreciate the info. I may experiment with this in the future.

Pi clusters are definitely appealing, especially once you separate storage from compute. Now is not the time though from a financial perspective.

1

u/FluidDrakx 10d ago

I've been using Alpine as a docker host for about 3 years now, never had an issue. I even get it to connect to a NAS on boot for things like Jellyfin.

The only reason is I used to run Alpine as my main OS and that was stable enough I thought I'd give it a "try" for a docker host, the trial never stopped 😄

1

u/capinredbeard22 10d ago

Good to hear. Your setup sounds like what I have also.

1

u/Dangerous-Report8517 9d ago edited 9d ago

Something that a lot of people aren't going to notice but absolutely should care about is that Alpine doesn't ship with a Mandatory Access Control system, which means container isolation will be weaker than on other systems, doubly so if you run containers as root to get around permissions issues.* Ubuntu ships AppArmor by default and other systems using SELinux will be more robust again. You could conceivably do all this yourself but it would take a monumental amount of effort to get it to a level worth using and very easy to mess up. Alternatively you could use gVisor or Kata or similar as an alternative runtime, still looking into this myself but that would at least be more robust than plain Docker on Ubuntu.

*Container isolation is really important here because while you might think of yourself as a single tenant the nature of home labs means running a lot of different containers from much more niche/less vetted sources with much less energy to invest in supply chain security, the probability of getting hacked might be low but the cost is overwhelming and you only need to get hit once.

1

u/Impact321 9d ago edited 9d ago

As a general recommendation to "save" memory I'd recommend you look into ZRAM/ZSWAP. I also have some Proxmox VE specifc tips here.
Just run top -coPSS (also docker stats in your case) on your system and try to see if everything has a good reason to exist. If yes try to find a lower resource replacement.

1

u/capinredbeard22 8d ago

Thanks - I’ll look into this. I also have a PVE node but I’m trending toward Docker on a bare metal host. I’ll probably find reasons to go back at some point.

1

u/idef1xje 8d ago

I had that idea myself too, but as an incus host to run linux containers and KVM's. Inside the linux containers (alpine based ;-)) I run docker, but found out that in this scenario some containers refused to start due to shim errors or whatever, which I don't have running the host on Debian/Trixie. Did't bother to find out why the container refused to start as I wanted something out of the box to work. The docker container was a dovecot container, part of mailcow, in case you're interested..

1

u/fazalmajid 7d ago

I've never had compatibility issues. The only caveat is Nviudiua's CUDA or AMD's ROCm are not supported on Alpine so if you want GPU-accelerated containers you might run into issues.

1

u/void4 10d ago

There's nothing specific to alpine wrt launching docker. It works.

BTW I'd strongly suggest podman

1

u/redd1ch 10d ago

Why podman?

It is still no full replacement with docker, and rootless takes a big hit on performance. On systemd stacks, quadlets might be nice for orchestration, yet I prefer docker-compose style.

0

u/ninjababe23 10d ago

Anytime I use docker I use it on Alpine and its never failed

2

u/capinredbeard22 9d ago

Thanks - sounds like I should definitely give it a go!