Docker Community Forums

Share and learn in the Docker community.

How to test the web service inside the docker swarm service

Hi, I am new to Docker. Recently I want to test the availability web service (which is Java Spring Boot program) in local and Docker swarm. In the program, I specify port 8080 for the Tomcat, so it will return the status code (200) in postman. However, when I try to put the program to the docker swarm, I can’t test the web service by typing this in postman:
127.0.0.1:8080/servicename/

Then I tried other way, which is use the ip of the container, but still no luck

For the docker swarm setting, I use a windows to init, and using localhost to run:
docker swarm init --advertise-addr=127.0.0.1 --listen-addr 127.0.0.1

docker service create --replicas 1 -p 80:80 --name test --mount source=afdiavol,target=/hia_ai_ms hijk/testing123:2.0.3.4t

Does any one have idea to test the web service which is inside the docker swarm service with postman?

Inspect a service on the swarm
If you haven’t already, open a terminal and ssh into the machine where you run your manager node. …
Run docker service inspect --pretty to display the details about a service in an easily readable format. …
Run docker service ps to see which nodes are running the service:

Thanks for your reply.
here is the information of docker service inspect --pretty:

May I know how can I use these information to let me test the web service using postman?