Is it possible to map a port to an external network?

Hello,

I am trying to create a Stack that uses an external network created in Portainer. Everything is working fine, except the port mapping to the static IP address. Essentially, those ports are not accessible.

version: "3"
services:
    npm:
      image: "jc21/nginx-proxy-manager:latest"
      restart: unless-stopped
      volumes:
        - ./data:/data
        - ./letsencrypt:/etc/letsencrypt
      expose:
        - "192.168.1.100:80:80/tcp"
        - "192.168.1.100:81:81/tcp"
        - "192.168.1.100:443:443/tcp"
      networks:
        npm_net:
          ipv4_address: 192.168.1.100
networks:
  npm_net:
    name: net
    external: true

You have to decide whether you want to set a static IP for a container or forward a port from the host. You just set the container IP and wanted to forward a port from the container IP to the container IP. That doesn’t make sense does it? It is also important to know how the external network was created. Is it really in a subnet in which the chosen IP is valid?

You also used expose instead of “ports”. I recommend reading the documentation.

Sorry the expose tag was set from testing the config. I hope I understand this correctly, you can’t set a static ip and open a port for this one with an external IP address? The ip is matching the subnet.

Thanks for the response:)