this post was submitted on 24 Mar 2025
32 points (97.1% liked)

Selfhosted

60910 readers
1286 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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

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

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I'm hosting a few services using docker. For something like an openstreetmap tileserver, I'd like it to remain on my SSD because high speed improves performance, and the directory is unlikely to grow and fill the drive.

For other services like NextCloud, speed isn't as important as storage size, so I might want it on a larger HDD raid.

I know it's trivial to move the volumes directory to wherever, but can I move some volumes to one directory and some volumes to another?

you are viewing a single comment's thread
view the rest of the comments
[–] Dave@lemmy.nz 20 points 1 year ago (3 children)

I don't know if this is naughty but I use bind mounts for everything, and docker compose to keep it all together.

You can map directories or even individual files to directories/files on the host computer.

Normally I make a directory for the service then map all volumes inside a ./data directory or something like that. But you could easily bind to different directories. For example for photoprism I mount my photos from a data drive for it to access, mount the main data/database to a directory that gets backed up, and mount the cache to a directory that doesn't get backed up.

[–] suicidaleggroll@lemm.ee 16 points 1 year ago* (last edited 1 year ago) (1 children)

Same, I don't let Docker manage volumes for anything. If I need it to be persistent I bind mount it to a subdirectory of the container itself. It makes backups so much easier as well since you can just stop all containers, backup everything in ~/docker or wherever you put all of your compose files and volumes, and then restart them all.

It also means you can go hog wild with docker system prune -af --volumes and there's no risk of losing any of your data.

[–] Dave@lemmy.nz 5 points 1 year ago

Yes that's what I do too!

Overnight cron to stop containers, run borgmatic, then start the containers again.

[–] catloaf@lemm.ee 10 points 1 year ago (1 children)

I've never not used bind mounts. That data is persistent. Nonpersistent data is fine on docker volumes.

[–] Dave@lemmy.nz 15 points 1 year ago (1 children)

Docker wants you to use volumes. That data is persistent too. They say volumes are much easier to backup. I disagree, I much prefer the bind mounts, especially when it comes to selective backups.

Volumes are horrible, how would I easily edit a config file of the programm running inside, if the container deosnt even start.

Bind mounts + ZFS datasets are the way to go.

[–] towerful@programming.dev 4 points 1 year ago (1 children)

I do that, until some container has permissions issues.
I tinker, try and fix it, give up and use a volume. Or I fix it, but it never seems to be the same fix

[–] Dave@lemmy.nz 9 points 1 year ago

I occasionally have had permissions issues but I tend to be able to fix them. Normally it's just a matter of deleting the files on the host and letting the container create them, though it doesn't always work it usually does.