

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Offline
incomplete
2: Break the Network
incomplete
3: Load Balancers
incomplete
4: Application Servers
incomplete
5: Custom Network
incomplete
6: Configuring the Load Balancer
incomplete
This lesson's interactive features are locked, please to keep using them
We can create custom bridge networks so that containers can communicate with each other if we want them to, but still otherwise remain isolated. Let's build a system where our application servers are hidden within a custom network, and only our load balancer is exposed to the host.
This is a very common setup in backend architecture. The load balancer is exposed to the public internet, but the application servers are only accessible via the load balancer.
docker network create caddytest
docker network ls
--network caddytest flag to attach them to the network--name flag to name them caddy1 and caddy2 respectively so it's easier to reference them latercaddy) in your docker run command. For example:
docker run -d --name caddy1 --network caddytest -v $PWD/index1.html:/usr/share/caddy/index.html caddy
-p flag to expose ports. We don't want these accessible from the host machine.docker run -it --network caddytest docker/getting-started /bin/sh
By giving our containers some names, caddy1 and caddy2, and providing a bridge network, Docker has set up name resolution for us! The container names resolve to the individual containers from all other containers on the network.
curl caddy1
curl caddy2
exit out of your shell session within the "getting started" container.Run and submit the CLI tests.
If you need to restart your caddy application servers after naming them, you can use: docker start caddy1 and docker start caddy2.