I am pretty sure I am missing a docker concept here, so hopefully someone can help me out.
My setup is as follows:
- Docker swarm using several hosts/nodes.
- One stack with two services: wordpress and sql
- New overlay network to connect wordpress to sql
- Wordpress publishes its port to the outside world.
When I deploy the stack the wordpress and sql container are created and they can reach each other perfectly as designed.
When I shut down the node that run sql, a new container is created on another host as replica is set to 1. This works as designed, however, wordpress now gives an error that it cannot connect to the sql server. I assume this is caused by the new sql container which got a new IP-address while wordpress is still looking for the IP-address of the original sql container.
I was expecting that docker would take care of this by using the service name of the docker task.
But here I might get lost…
stack.yml file I use:
Any advice how this should or can work?