Running a service through a reverse proxy
We want the go-demo service to be able to communicate freely with the go-demo-db service and to be accessible only through the reverse proxy. We already know how to accomplish the first part. All we have to do is make sure that both services belong to the same network go-demo.
How can we accomplish the integration with a reverse proxy?
We can start by creating a new network and attach it to all services that should be accessible through a reverse proxy:
docker network create --driver overlay proxyLet's list the currently running overlay networks:
docker network ls -f"driver=overlay"The output is as follows:
NETWORK ID NAME DRIVER SCOPE
b17kzasd3gzu go-demo overlay swarm
0d7ssryojcyg ingress overlay swarm
9e4o7abyts0v proxy overlay swarmWe have the go-demo and proxy networks we created earlier. The third one is called ingress. It is set up by default and has a special purpose that we'll explore later.
Now we are ready to run the go-demo service...