I have created one service and exposed it to run only on localhost in one of my docker swarm node but I can access the service publicly too easily.
I have deleted and redeployed the docker stack but still same issue.
Here is my docker-compose.yml I have used to deploy the service in stack
version: "3"
networks:
api-net:
ipam:
config:
- subnet: 10.0.10.0/24
services:
health-api:
image: myprivateregistry:5000/healthapi:qa
ports:
- "127.0.0.1:9010:9010"
networks:
- api-net
depends_on:
- config-server
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
I haven't added the service on which it depends as I don't think that is the problem.
Few says its not supported in docker swarm mode. Than what is solution in that case.