I am running docker and docker compose on my main home lab server. The server has a network card and 2 different static IPs 1 of witch are in a separate /24s then my "main" network.
I want to pass the IoT Network IP address assigned to the server (192.168.7.200) instead of the main network IP for the server (192.168.1.100).
I have a config.yaml for the compose, but I think I did something wrong. When I run:
docker-compose up -d
Everything says it worked correctly but I am not able to get to the homeassistant interface.
I can browse to the Portainer interface with the main IP (192.168.1.100:9000) and even see in the status of the homeassistant container that the network settings look correct.

When I browse to homeassistant interface (192.168.7.200:8123) nothing happens.
I think I might be creating a fake network that is clashing with the real IP of the home lab server.
Below is the .yaml file I am using.
version: '3.0'
services:
portainer:
container_name: portainer
image: portainer/portainer-ce
restart: always
ports:
- "9000:9000/tcp"
environment:
- TZ=Europe/London
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/portainer:/data
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /opt/homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
privileged: true
networks:
static-network:
ipv4_address: 192.168.7.200
networks:
static-network:
ipam:
config:
- subnet: 192.168.7.0/24
Im new to docker other than some random edits I had to do at my old job, so please be kind lol.
I have looked around online for ways to pass ip address to the docker container, and I know that if I use:
network_mode: host
In the .yaml it will allow me to browse to the homeassistant interface with the main ip (192.168.1.100:8123), but like I said I would like to use the IoT IP address associated with the main server 192.168.7.0/24.
You are making another network with the
192.168.7.0/24ip range which is overlapping with the external network.One way to avoid this is to make a network in your docker-compose which is external and create the bridge network from the command line , like this:
And manually create the network:
If something goes wrong , ask away!
Hope that helps!