Help with docker-compose and network modes reddit / selfhosted ---------------------------------------------------------------------- Trousers_Rippin · 2023-10-23 16:34 When I install ghost and SQL via docker-compose on my QNAP NAS. It doesn't get a host network IP address but a completely different address. The installation works locally but will not through my NPM reverse proxy with cloudflare. I understand why it won't work but can someone explain to me how I can get the ghost/sql container to use host networking? I have lots of other stuff running on my homelab that works self hosting but they all use the IP of the NAS. ​ ---------------------------------------------------------------------- thekrautboy · 2023-10-23 16:58 By using `network_mode: host` ---------------------------------------------------------------------- Trousers_Rippin · 2023-10-23 17:45 Tried that. It works with single containers but is ignored with multiple apps in a container (sorry, not to good with the terminology yet). I'm not sure if its a QNAP NAS container station thing. ---------------------------------------------------------------------- thekrautboy · 2023-10-23 17:53 If you have multiple containers (services) in one compose (a stack) then you need to set network_mode for each container separately, you cannot set it globally for all of them. The Docker documentation explains all of that. ---------------------------------------------------------------------- Trousers_Rippin · 2023-10-23 18:05 Thanks. I have tried network\_mode: host for each service in the stack and yet it makes a separate bridge network each time. This is what I'm using. version: '3.7' services: db: image: mariadb:latest restart: unless-stopped network\_mode: host environment: \- TZ=Europe/Stockholm \- MYSQL\_ROOT\_PASSWORD=\*\*\*\*\* \- MYSQL\_USER=\*\*\*\*\* \- MYSQL\_PASSWORD=\*\*\*\*\* \- MYSQL\_DATABASE=\*\*\*\*\* ports: \- 3306:3306 volumes: \- /share/CACHEDEV1\_DATA/Container/ghost/config/mysql:/var/lib/mysql \- /etc/localtime:/etc/localtime:ro labels: \- com.centurylinklabs.watchtower.enable=true app: image: ghost:latest restart: unless-stopped network\_mode: host environment: \- TZ=Europe/Stockholm \- database\_\_client=mysql \- database\_\_connection\_\_host=\*\*\*\*\* \- database\_\_connection\_\_user=\*\*\*\*\* \- database\_\_connection\_\_password=\*\*\*\*\* \- database\_\_connection\_\_database=\*\*\*\*\* \- url=http://10.1.1.2:2368 ports: \- 2368:2368 volumes: \- /share/CACHEDEV1\_DATA/Container/ghost/config/content:/var/lib/ghos t/content \- /etc/localtime:/etc/localtime:ro depends\_on: \- db labels: \- com.centurylinklabs.watchtower.enable=true ---------------------------------------------------------------------- thekrautboy · 2023-10-23 19:04 > The Docker documentation explains all of that. > > > > And /r/Docker and /r/Synology both exist. ---------------------------------------------------------------------- Old-Satisfaction-564 · 2023-10-23 19:17 This is the correct format for host networking, also url is definitely wrong if you proxy the ghost container: `ports:` `- target: 80` `published: 80` `protocol: tcp` `mode: host` `- target: 443` `published: 443` `protocol: tcp` `mode: host` `- target: 8443` `published: 8443` `protocol: tcp` `mode: host` `- target: 8080` `published: 8080` `protocol: tcp` `- target: 853` `published: 853` `protocol: tcp`