Hi,

I’m using docker-compose to host all my server services (jellyfin, qbittorrent, sonarr, etc.). I’ve recently grouped some of them into individual categories and then merged the individual docker-compose.yml file I had for each service into one per category. But is there actually any reason for not keeping them together?

The reason why is I’ve started configuring homepage and thought to myself “wouldn’t it be cool if instead of giving the server IP each time (per configured service in homepage) I’d just use the service name?” (AFAIK this only works if the containers are all in the same file).

4 points

I personally don’t. It is just messier. I only group things that belong together, like a webserver+database, torrentclient+vpn and so on.

permalink
report
reply
15 points
*

No, keep them ungrouped, migration to a new server is much easier, otherwise you need to migrate everything everywhere all at once

You can have the same effect (connect to the named container) if you create a docker network and place everything on the same network

permalink
report
reply
38 points

I have a folder that all my docker services are in. Inside the folder is a folder for each discrete service and within that folder is a unique compose file necessary to run the service. Also in the folder is all the storage folders for that service so it’s completely portable, move the folder to any server and run it and you’re golden. I shut down all the services with a script then I can just tar the whole docker folder and every service and its data is backed up and portable.

permalink
report
reply

Could you share your script?

permalink
report
parent
reply
2 points

Exactly what I do except my master folder is ~

permalink
report
parent
reply
2 points

I do ~/docker so I also have a docker-prototype folder for my sandbox/messing around with non-production stuff and I have a third folder for retired docker services so I keep the recipe and data in case I go back.

permalink
report
parent
reply
6 points

In case anyone cares here is my script, I use this for backups or shutting down the server.

#!/bin/bash

logger "Stopping Docker compose services"

services=(/home/user/docker/*)    # This creates an array of the full paths to all subdirs
#the last entry in this array is always blank line, hence the minus 1 in the for loop count below

for ((i=0; i<=(${#services[@]}-1); i++))
do
    docker compose -f ${services[i]}/docker-compose.yml down &
done

#wait for all the background commands to finish
wait 
permalink
report
parent
reply
1 point

@czardestructo I like the tidiness of this.

permalink
report
parent
reply
1 point

Does portainer just work?

permalink
report
parent
reply
1 point

To answer my own question, yes, yes it does. Should’ve done this ages ago…

permalink
report
parent
reply
4 points

Exactly my setup and for exactly the reasons you mentioned

permalink
report
parent
reply
6 points

This is exactly what I do and could not be happier!

permalink
report
parent
reply
2 points

I was thinking about that just today, I have something like 30+ services running on a single compose file and maintenance is slowly becoming hard. Probably moving to multiple compose file.

permalink
report
reply
3 points
*

I’ll be the opposite of everyone I guess I have all my services in one compose file. Never had an issue with it. Why I have no exposed ports and everything is accessed through a reverse proxy, and the big one it’s easy to just go docker compose and have them all come up or down.

permalink
report
reply
1 point

Same for me, it all mostly started from the desire to have a single MariaDB and Postgresql container holding all the databases. Not sure if I could achieve the same result with different compose files, perhaps I can, bit never had the need.

I actually find my setup super comfortable to use

permalink
report
parent
reply

Selfhosted

!selfhosted@lemmy.world

Create post

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!

Community stats

  • 3.4K

    Monthly active users

  • 3.3K

    Posts

  • 71K

    Comments