I have one docker compose file to deploy a stack to swarm. I am deploying the stack on windows server 2019 1809. Now container get deployed but I am not able to connect to internet from the container running in swarm mode. But I am able to connect to internet when I run container in normal mode. Can anyone tell how can I access internet from container when container runs in swarm mode. I want to access internet from container as I have database on rds. I am deploying this on EC2 Instance of windows 2019 1809.
The other part is I am able to resolve the issue with some hacks I connect nat network to container and mask the route in container so the traffic goes through nat network by default so I am able to connect to internet But this requires lots of manual steps and we want to automate this. So for this I want to attach nat network to the swarm containers using docker compose file but I am getting error in this like
Error response from daemon: The network test1_nat cannot be used with services. Only networks scoped to the swarm can be used, such as those created with the overlay driver.
Can anyone know how can I attach nat network to container using docker compose file.