Hi guys! I have several docker containers running on my home server set up with separated compose files for each of them, including a Pihole one that serves as my home DNS. I created a network for it and a fixed IP but I couldn’t find a way to set fixed IPs to the other containers that use the Pihole network. Well everything works but every now and then I have problems because the Pihole cant start first and grab the fixed IP and some other container gets its IP so nothing works because everything depends on the Pihole to work. My Pihole compose is like this:

`networks: casa:

driver: bridge
ipam:
  config:
    - subnet: "172.10.0.0/20"

networks:

  casa:
    ipv4_address: 172.10.0.2`

My Jellyfin container as an example is like this:

`_networks: - pihole_casa dns: - 172.10.0.2

networks: pihole_casa: external: true__`

I read the documentation about setting fixed IP but all I got was using one single compose file and with 12 containers that seems like a messy solution… I couldn’t set fixed IPs with different compose files. Do you guys have any suggestion about it?

Thanks!

TLDR: I want to set fixed IPs to containers in different compose files so all of them use Pihole as DNS and don´t steal Pihole’s IP in the startup

I think what you’re describing can be accomplished with docker-compose’s depends_on option. I’m not certain how it works across compose files, but that would be the first place I’d look.

fernandu00
creator
link
fedilink
11Y

Yeah…seems like the depends_on works with multiple services in one single compose file…and putting 10 services in tha same compose file is messy

Self Hosted - Self-hosting your services.
!selfhost@lemmy.ml
Create a 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

  • No harassment
  • crossposts from c/Open Source & c/docker & related may be allowed, depending on context
  • Video Promoting is allowed if is within the topic.
  • No spamming.
  • Stay friendly.
  • Follow the lemmy.ml instance rules.
  • Tag your post. (Read under)

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

  • Lemmy doesn’t have tags yet, so mark it with [Question], [Help], [Project], [Other], [Promoting] or other you may think is appropriate.

Cross-posting

If you see a rule-breaker please DM the mods!

  • 1 user online
  • 1 user / day
  • 1 user / week
  • 12 users / month
  • 36 users / 6 months
  • 1 subscriber
  • 161 Posts
  • 283 Comments
  • Modlog