Hi,
maybe it’s to late in the evening, but I’m not able to setup a network binding/ip with port, e.g.:
$ docker run -d --rm --name=portainer \
-v data:/data -v /var/run/docker.sock:/var/run/docker.sock \
--net=dmz_net --ip=192.168.90.20 -p 192.168.90.20:8008:9000 \
portainer/portainer
It shall setup on 192.168.90.20 (dmz_net) port 8008 (or even 80, which doesn’t work too).
$ docker inspect portainer
[
...
"NetworkMode": "dmz_net",
"PortBindings": {
"9000/tcp": [
{
"HostIp": "192.168.90.20",
"HostPort": "8008"
}
]
},
....
"NetworkSettings": {
"Bridge": "",
"SandboxID": "e039d28d590eb947e5892e3bc73454229ccb8d52e6656b5cdf98a12d1c90a150",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/e039d28d590e",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dmz_net": {
"IPAMConfig": {
"IPv4Address": "192.168.90.20"
},
"Links": null,
"Aliases": [
"e15beb2c36e5"
],
"NetworkID": "01d26c8ac1983029a087a6c509036180a432f9894ff78a9860d2a04aa3a9693a",
"EndpointID": "4d34ce23ee474db9a2eb6e50adf98cc9bcc616aa91f08f43b6fc11fbc0239a89",
"Gateway": "192.168.90.1",
"IPAddress": "192.168.90.20",
"IPPrefixLen": 24,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:c0:a8:5a:14",
"DriverOpts": null
}
}
}
}
]
also, netstat doesn’t show anything:
$ sudo netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:40231 0.0.0.0:* LISTEN 0 21137 398/containerd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 98 20051 369/systemd-resolve
tcp 0 0 :::22 :::* LISTEN 0 2755 1/systemd
udp 0 0 127.0.0.53:53 0.0.0.0:* 98 20050 369/systemd-resolve
but probably I miss something here (I’m new to vlan networking). Nevertheless, I can connect to the default port successfully:
$ curl -I 192.168.90.20:9000
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=31536000
Content-Length: 23032
Content-Type: text/html; charset=utf-8
Last-Modified: Thu, 19 Mar 2020 22:46:17 GMT
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Tue, 19 May 2020 19:16:17 GMT
but not from port intended:
$ curl -I 192.168.90.20:8008
curl: (7) Failed to connect to 192.168.90.20 port 8008: Connection refused
The docker network is VLAN:
$ docker inspect dmz_net
[
{
"Name": "dmz_net",
"Id": "01d26c8ac1983029a087a6c509036180a432f9894ff78a9860d2a04aa3a9693a",
"Created": "2020-05-19T20:10:05.768577941+02:00",
"Scope": "local",
"Driver": "macvlan",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.90.0/24",
"Gateway": "192.168.90.1",
"AuxiliaryAddresses": {
"dmz-docker-host": "192.168.90.11"
}
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"b0a3a365d437130a56e2e9a315255201f407f0489757a2576076da36a36fdec7": {
"Name": "portainer",
"EndpointID": "fa6416ef24ef17e131718bb62bf6874f47b99fe3eefe9a9fc9fe4e8a1672054d",
"MacAddress": "02:42:c0:a8:5a:14",
"IPv4Address": "192.168.90.20/24",
"IPv6Address": ""
}
},
"Options": {
"parent": "dmz"
},
"Labels": {}
}
]
configured as:
$ ip -d link show dev dmz
5: dmz@enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether d0:50:99:a3:b0:84 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 0 maxmtu 65535
vlan protocol 802.1Q id 90 <REORDER_HDR> addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 64000 gso_max_segs 64
$ ip route list table 90
default via 192.168.90.1 dev dmz proto static
So, what went wrong here?