[英]get the IP adress to use for a docker container on a network
My NAS is where I run my containers.我的 NAS 是我运行容器的地方。 It sits on
192.168.1.23
on my network.它位于我网络上的
192.168.1.23
上。
I am running a few containers inside a user-defined network.我在用户定义的网络中运行一些容器。 Here is the
docker network inspect
(I've removed the containers manually):这是
docker network inspect
(我已经手动删除了容器):
[
{
"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:我在 IP 地址
192.168.90.16
的网络中有一个特定的容器,我在 docker-compose 中使用以下内容公开了9118
端口:
ports:
- target: 9118
published: 9118
protocol: tcp
This is the portainer screenshot:这是搬运工屏幕截图:
I was expecting to be able to connect to that container using 192.168.1.23:9118
but I tried to no avail.我希望能够使用
192.168.1.23:9118
连接到该容器,但我尝试无济于事。
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?
我需要更改哪个设置才能使该容器在我的 NAS IP 地址上的该端口可见?
The port that the container was listening to was incorrect.容器监听的端口不正确。 I needed to modify the
ports
configuration to:我需要将
ports
配置修改为:
ports:
- target: 9117
published: 9118
protocol: tcp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.