MySQL cluster Replication and Failover via docker-compose
You may have set up replication, but failover doesn't just magically happen by itself. You need also

Some kind of cluster manager to notice the failure and initiate the failover procedure.
Complete the failover procedure and ensure that the new master is operational. Part of the process is described here.
A floating IP address or some sort of connection proxy to direct incoming connections to the new master.