These are chat archives for spring-cloud/spring-cloud

23rd
Oct 2017
Patrick Cornelißen
@pcornelissen
Oct 23 2017 11:03
@thiago-santos Looks like you got no response, so I’ll give it a try: You can’t expose a random port without much fuzz (disclaimer: it works but is ugly as hell) When I was faced with the problem I have created a set of docker-compose files, one contains the „prod ready“ definitions without (host-)exposed ports and one with exposed ports where each service gets a unique fixed port that is also configured in spring boot for local development. The big problem is that generated URLs for example are simply broken if the port spring boot uses is different than the port of the container if you don’t patch the URLs yourself, which is very bad as well. so, long story short: When using docker, don’t use randomized ports.
Thiago Santos Joaquim
@thiago-santos
Oct 23 2017 12:49
@pcornelissen Tx man, for your response!!!! For now, i found an partial solution. I create a network (doker network create XPTO) and using a plugin for docker of spotfy i create a dockerfile without exposing a port and start all the microservices in that network (XPTO). Because all in the same network all containers see each other. For now the solution meet my needs. But in a near future i have to locate another solution....
Patrick Cornelißen
@pcornelissen
Oct 23 2017 13:07
@thiago-santos ah, yes if you only have docker containers talking to each other you don’t need to expose the port at all and just put them in a shared network. Then they can acces each other. This is standard docker networking. I thought you wanted to access the services from outside of the docker networking. For docker2docker communication you can use random ports but it doesn’t make sense because each container gets his own IP anyway (if you don’t use host networking) and then each service can use a fixed port (and in this case you should use the default ports to make things easier)