this post was submitted on 18 Dec 2025
41 points (93.6% liked)

Selfhosted

53743 readers
614 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.

  7. No low-effort posts. This is subjective and will largely be determined by the community member reports.

Resources:

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

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

For user-readable files or media I store them under ~/docker/data, and for everything else I store them under ~/docker/stacks/[service] where ~/docker/stacks is maintained by Dockge.

Is there a better way to do this?

top 22 comments
sorted by: hot top controversial new old

/srv/[stack name]/volumes/[binds]

I just like so much /srv is the best folder

[–] GreenKnight23@lemmy.world 1 points 18 hours ago

I mount them directly from the NAS inside docker volumes.

if there are any configuration/local data files that need to be persistent, those are usually kept in ~/project/{container}. the compose file is kept at the root project directory.

home user is a daemon user created specifically for running docker containers that does not have root privileges.

[–] DasFaultier@sh.itjust.works 20 points 1 day ago (2 children)

I tend to use /opt/[service]/, like for example /opt/forgejo/. It's outside of any user's Homedir and it seems to fit into what the FHS 3.0 (Filesystem Hierarchy Standard) defines.

[–] solidgrue@lemmy.world 7 points 1 day ago

I use /srv/[service] for services by the same logic, and leave /opt for local user apps. It's kind of a coin toss though. On another day I night have decided differently.

[–] eli@lemmy.world 2 points 1 day ago (1 children)

I do this as well. Though if I'm deploying a stack(grafana+prometheus+cadvisor) then it all goes under a single folder like /opt/stackname/

But if I'm running multiple services that are mostly separate or not in the same stack then they go in their own folders like /opt/nginx/ and /opt/grafana/

[–] DasFaultier@sh.itjust.works 2 points 12 hours ago

Yes, that's what I meant, thanks for the clarification.

[–] panda_abyss@lemmy.ca 6 points 1 day ago* (last edited 1 day ago)

My docker mounts just point to the folder they live in.

I’d rather have the data stored next to the config so it’s easy to find and manage.

So a folder would be services and have a compose file, config folder, and a data folder with subdirectories per service I run. Any custom dockerfiles get a folder with their build scripts.

[–] Damarus@feddit.org 14 points 1 day ago (1 children)

I have multiple compose stacks with one folder each, and they also contain all the bind volumes and any other extra files needed.

[–] fleem@piefed.zeromedia.vip 4 points 1 day ago

it makes it all so easy to scp that bitch!

[–] tal@lemmy.today 6 points 1 day ago (1 children)

Bind mounts aren't specific to Docker. You're asking specifically about bind mounts as used by Docker?

[–] eager_eagle@lemmy.world 4 points 1 day ago (1 children)

along with the compose.yaml file, unless I need it in a different drive for any reason

[–] fizzle@quokk.au 2 points 15 hours ago

This is me.

For example, /srv/docker/synching contains:

compose.yml .env ./Sync

That last one is a directory bound to the container which contains all my sync folders.

Occasionally it makes more sense to put the mounted folder in /srv like /srv/photos is mounted by /srv/docker/photoprism/compose.yml

However, thats a rarity. Things mostly accessed by a single compose stack are kept alongside the other files for that stack.

[–] PabloSexcrowbar@piefed.social 4 points 1 day ago (2 children)

I always use /docker, but I recognize that's probably not the most "correct" place.

[–] JASN_DE@feddit.org 2 points 1 day ago

Same here, separate disk mounted at /docker

Doing the same, works fine and is easy to backup 😌

[–] Appoxo@lemmy.dbzer0.com 2 points 1 day ago

/opt/docker/[service]

[–] HybridSarcasm@lemmy.world 1 points 1 day ago

/docker/compose/ for compose and env files

/docker/data/ for data to be retained

I let the docker overlay handle all the volatile data.

[–] bulwark@lemmy.world 1 points 1 day ago

I use the same naming convention as you for stacks, but since I'm running a docker swarm I have to mount the NFS in the exact same way on all my nodes, which are just 3 R-Pi 4s. It's a little janky in that if the NFS goes offline all my services go along with it. Traefik works really well with a swarm, especially when you have it set to auto pick up any services and proxy them.

[–] TheRagingGeek@lemmy.world 0 points 1 day ago

I run a swarm and the NAS~esque machine has its exportfs entries under /export so all my docker persistence data goes into /export/docks///

[–] HereIAm@lemmy.world 0 points 1 day ago

I didn't think much of what the "correct" location would be. But i have a general kinda everything share at /var/share/[music,books,video,user folders,repo]. And then any caching or config data sits in that dockers home folder under /etc/docker/[jellyfin,immich,kavita,etc] together with its docker-compose file. All docker services run under the group user so they all have access to the share.

[–] emax_gomax@lemmy.world 0 points 1 day ago

Xdg. Its the only attempted standard for where to put things. Persistent data in ~/.config/docker/service. Others in similar directories under ~/.local/share, ~/.cache, etx.