How do I configure the network as a container (joined container) mode in the docker-compose.yaml file?

I built the lnmp environment using docker-compose.
Communication between php and redis containers using container names is fine, but I want to share a network card through both containers, and php connects to redis through 127.0.0.1.
how to write a requirement yaml file like this?

Mar.23,2021
Menu