When the containers are within the same compose file, they will be connected to an implicit Docker network. Even better is to use an explicit declared Docker network to attach the containers to it. That can also be used by other compose file services.
The db container will only create a single user, so you need to manually create more users. Or use the same user with different databases.
Personally I prefer bind mounts to Docker volumes. You can’t accidentally delete them as easy and they are easier to backup IMHO.
Note that a single WordPress instance can run multiple sites.
When using multiple containers, usually a reverse proxy is used to handle multiple domains on the same ip:port. Check nginx-proxy with companion or Traefik (example), both can be auto-configured by env vars or labels on target service, manage TLS/SSL.
Hi, thank you very much, regarding the proxy, I am using the nginx proxy manager.
I didn’t understand this:
Personally I prefer bind mounts to Docker volumes. You can’t accidentally delete them as easy and they are easier to backup IMHO.