Adding a network for the location microservice
We can now specify the network on which the application shall run instead of using the default network, as we did previously. The network shall be named geolocation-network
, and we also need a network for Redis. We shall add those networks to Compose:
services: location-service: [...] networks: - location-network - redis-network [...] redis: image: redis networks: - redis-network networks: location-network: redis-network:
Redis does not expose any port locally; the geolocation service is able to access the service only because it has redis-network
included in the networks
section. redis-network
is a familiar name. It is the same network name we used in Chapter 3, Network and Volumes Fundamentals. Since our...