Inter-container networking for apps

Hello there. I struggled with a similar problem and I think, I found a solution on how to enable inter-container communication with TrueNAS native apps (no custom yaml needed) to connect e.g. to the Nginx Proxy Manager App.

Optionally: In the App config (e.g. immich, paperless-ngx etc.) set Port Bind Mode to “Expose port for inter-container communication”. Than only TrueNAS containers can connect to this app. All other LAN clients (PCs, smartphones etc.) will have to use the reverse proxy.

  1. On TrueNAS host (e.g. via ssh) list all available docker networks with

    sudo docker network ls
    

    each App will get it’s own one by default (e.g. “ix-internal-immich-immich-net”)

  2. In the setting of the App you want to connect (e.g. Nginx Proxy Manager App) scroll down to Network ConfigurationNetworks[Add]

    • Name: the docker network from above (e.g. “ix-internal-immich-immich-net”)
    • Containers[Add]
      • Container Name: (dropdown automatically populates) pick the current container (e.g. “npm”)
  3. In NPM Add Proxy Host

    • for Forward Hostname / IP use the container name (e.g. “ix-immich-server-1”)
      • you can look that up on TrueNAS host (e.g. via ssh) with
        sudo docker ps
        
    • the Forward Port is usually the same as if you exposed the app to the LAN (e.g. 30041 for immich) but sometimes it’s 80 (e.g. for “ix-it-tools-it-tools-1”). You can check this via docker ps too in column “PORTS”

Notes:

  • I am not an expert, so no guarantees. This is my first post in this forum :wink:
  • You could also add the NPM network (“ix-nginx-proxy-manager_default”) to each App to achieve inter-container connectivity (that seems to be the method behind Dragonify) but as of my understanding that would be a potential security issue because now each app can talk to every other app because they are all in the same network. By adding each app network individually to the NPM app instead, the apps stay disconnected from each other.
  • workarounds like docker network create npm-internal (as proposed in related topics, see below) would not survive TrueNAS upgrades etc. as of my understanding.

Related: