Proxy Network
To allow communication between services in your local cloud, you will need to create a network that all services can connect to. This network will be used to route traffic between container services and to the outside world.
We will call this network proxy
.
docker network create proxy
tip
Do not confuse with HTTP Proxy
Once this network is created you should be able to see it in your list of networks.
docker network ls
NETWORK ID NAME DRIVER SCOPE
65fa891d8b1b bridge bridge local
c7a24debb6b9 host host local
dee6c0085016 none null local
b30af89e8bf0 proxy bridge local
We can now refer to this network by name proxy
and attach containers to it.
- Docker CLI
docker run -d --name=traefik --network=proxy traefik:v2.5
- Docker Compose
networks:
proxy:
external: true
services:
traefik:
image: traefik:v2.5
networks:
- proxy
This will attach the container to the proxy
network and allow it to communicate with other services on the network.