Microservice port conflict at localhost
See original GitHub issueNot sure it’s a bug or a ‘feature’
ERROR: for customergateway-postgresql Cannot start service customergateway-postgresql: b'driver failed programming external connectivity on endpoint docker_customergateway-postgresql_1 (7e89d2b724f17888bd1097ac2dd3acda2abcbaee5f0641a8361dca01da1d2495): Bind for 0.0.0.0:5432 failed: port is already allocated'
An attempt to create a simple microservice app with the same DB type. It can be easily solved by setup DB ports for each microservice in JDL. Or even better do not use localhost at all! Use just hostnames like
customergateway-postgresql:5432
instead of
localhost:5432
I this case ports will never collide for services also it’s obvious by name ‘which-is-which’.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
8080 port already taken issue when trying to redeploy project ...
You need to kill the port that localhost:8080 is running on. To do this, you need to do two commands in the terminal...
Read more >Why you should never use fixed ports in your Testcontainers ...
Bind for 0.0.0.0:80 failed: port is already allocated. But there is more - localhost is the king! There was some ...
Read more >TCP connect to localhost:8083 failed while installing ...
You're focusing on the port, but the issue seems to be that the service isn't starting in the first place. Most likely a...
Read more >3 Ways to change Embedded Tomcat Server Port in Spring ...
Since by default, HTTP requests go to port 80, and if you have forwarded that request to 8080 and if your Spring Boot...
Read more >Sharing routes and running multiple Java services in a single ...
Once again everything is working but under a single port this time. One Server Listening on Multiple Ports. Testing microservices, especially ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had a look at https://hub.docker.com/r/strm/dnsmasq/ and indeed, it could be a solution. But not sure it will work well for users with Windows.
Then, after thinking more about this feature request, I don’t think we will change something in our main generator-jhipster as the change is trivial and can be done in less than 30sec.
Adding a new option would be overkill, and we’ll have to do the same think for all database, all other services, and maintain it.
What can be done are:
For now, let’s close this.
@mmuruev :
To resolve this, IMO, the best would be:
jhipster docker-compose
, it will generate a big docker-compose fileI think it’s the best solution because when I start to dev, I launch this big docker-compose, instead of thinking about which services inside each microservices (consul, keycloak, kafka, psql etc etc)
Then, I don’t think we should include your feature in main generator, as we will need to do the same for all databases, store the config in yo-rc.json, add the option in JDL, maybe change all config in docker-compose, heroku, gcp, openshift, aws etc etc… Too much work for 1 or 2 minutes with sub generator docker-compose
Hope my solution will help you