Adding an extra network to the current application
So far, our containers have been running and communicating transparently, and we have managed to define the bridge network the services would use. Another thing we have observed is that the bridge network that used to be created by default no longer exists. Since we saw only one network being used at a time, we will add multiple networks in Compose.
The target for this would be our Redis database. In real life, databases usually reside on another network and are linked to your application:
networks: redis-network: labels: - com.packtpub.compose.app=task-manager
We will attach the Redis database to that network:
redis: image: redis ports: - 6379:6379 entrypoint: ["redis-server","/usr/local/etc/redis/redis.conf"] ...