SCENARIO:
Hey there,I'm running a docker compose with containers.
This compose file works like charm on ma local docker desktop on windows 10.
I configured my own network with network driver bridge.
Now I want to run the docker compose on an external server with an ubuntu vm.
I have remote putty connection to the server. When I run docker-compose up
all my services start successfully. I also have portainer running to have a gui control on that.
PROBLEM: Lika I said, all my services are an running. The only difference to my local setup is that I startet portainer as a single container. I cann connect to portainer with my Browser and inspect the whole setup. But when I want to call my expose container, I can't get a connection and get a connection faild error. When I have a look at the IP Adress Column in portainer in the Containers spec, I see that portainer has a different ip than my docker compose containers. So portainer has 172.17.xxx and all the other containers start with 172.20.xxx Obviosly my exposed ports in my private network are not exposed to the host bridge network.
What I expect I want to have my exposed ports to be availble by the ip of my virtual machine like my portainer instance.
Thoughts I'm pretty new to docker so I checked the docs and I thought because of the description:
Within a user-defined bridge network, linking is not supported. You can expose and publish container ports on containers in this network. This is useful if you want to make a portion of the bridge network available to an outside network.
..that bridge as the network driver would connect my network to the local host internet connection.
Question: Is there something wrong when I run portainer seperate from my compose? Is there something else to keep in mind when I run my compose on an external server and not on my localhost in point of networking?
compsose network cfg:
networks:
my_net:
driver: bridge
and my compose Version is 2.1
UPDATE: Docker ps says all up and running docker inpsect on a container I want to reach via Internet:
"NetworkSettings": {
"Bridge": "",
"SandboxID": "9e1e335ab30f1f4d3f690e8902e06523fa095e7d8bshddkdksis7d66s7sjdjd",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"7778/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "7778"
}
]
},
"SandboxKey": "/var/run/docker/netns/9e1e386ttf56",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"my_net": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"3cb72e02c43b",
"usermanagement-service"
],
"Gateway": "172.20.xx.x",
"IPAddress": "172.20.xx.xx",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"DriverOpts": null
}
}
}
}
docker ps
ordocker inspect
result for the container you want to expose ? – Junji7778
exposed which can be access by anyone. what happen when you try to connect to it using the public ip and the port ? – Junjitimeout
? orconnection refused
? or something else ? – Junji