Reputation: 352
I am running a docker-compose'd architecture with a registry, gateway (8080), uaa (9999), and 2 microservices (8081 and 8082) and I can see the Swagger API in the gateway app via dropdown selection. I can login to the gateway with admin and user. I've also modified to the code to accept an owner, agent, and monitor role. I can login just fine.
In a terminal I tried Baeldung's curl command (Blog posting) to get a token from the uaa server directly for testing APIs.
[~]$ curl -X POST --data "username=user&password=user&grant_type=password&scope=openid" http://localhost:9999/oauth/token
curl: (7) Failed to connect to localhost port 9999: Connection refused
I opened Kitematic and the uaa server is localhost (host) and 9999 (port) in the docker container log.
Can someone help me figure out why Curl is not working for me?
thanks,
David
Upvotes: 0
Views: 385
Reputation: 4230
This issue is almost certainly related to the network properties of the stack that you are deploying.
If you are issuing the curl command from the host machine to http://localhost:9999, then you need to make sure that the UAA server is mapping it's port to the host.
Does your UAA service have this in the docker-compose.yml
?
ports:
- "9999:9999"
If not, you need to add it in order to test it from the host.
By default, docker-compose will create a bridge network for your stack, where your containers can talk to eachother and resolve eachother on container names. But from the host, you will not be able to address the containers unless you explicitly map their exposed ports to the ports on the host.
Upvotes: 1