I’m having trouble configuring Docker Swarm. Currently, when I deploy services with assigned ports in Docker Swarm, they automatically become public. In Docker Compose, I can easily control which ports are public and which are private, but I can’t find a similar option in Docker Swarm.
My current workaround involves running an additional container under Docker Compose as a proxy. This container communicates with other containers within Docker’s private network, allowing me to access the services without exposing them to the outside world. Ultimately, I access these services only through a VPN.
Is there a better way to configure Docker Swarm so that the ports are not automatically public? How can I set up services in Docker Swarm to be available only within Docker’s private network?