Chapo
Chapo

Reputation: 2543

get the IP adress to use for a docker container on a network

My NAS is where I run my containers. It sits on 192.168.1.23 on my network.

I am running a few containers inside a user-defined network. Here is the docker network inspect (I've removed the containers manually) :

[
    {
        "Name": "traefik2_proxy",
        "Id": "fb2924fe59fbb0436c72f11cb028df832a473a165162ecf08b7e3a946cfa2d3c",
        "Created": "2020-05-13T23:23:16.16424119+08:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.90.0/24",
                    "Gateway": "192.168.90.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]

I have a specific container which is in that network at IP address 192.168.90.16 for which I have exposed the 9118 port using the following in my docker-compose :

ports:
  - target: 9118
    published: 9118
    protocol: tcp

This is the portainer screenshot :

enter image description here

I was expecting to be able to connect to that container using 192.168.1.23:9118 but I tried to no avail.

What am I missing ? Which setting do I need to change for that container to be visible at that port on my NAS IP address ?

Upvotes: 6

Views: 222

Answers (1)

Chapo
Chapo

Reputation: 2543

The port that the container was listening to was incorrect. I needed to modify the ports configuration to:

ports: 
  - target: 9117 
    published: 9118 
    protocol: tcp

Upvotes: 3

Related Questions