Each container should serve a single purpose, such as running one application like a web server. Containers can be powerful by themselves, but when connected together, they are far more useful. For example, a web server container can be connected to a database container to provide application storage. Docker provides multiple options for networking containers. In this lab, you’ll explore a few of the common types of networks that Docker supports, and learn how containers within those networks interact.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Explore the Default Network
- List the default networks.
- Run an
httpd
container namedweb1
without specifying a network and see which network it uses. - Attempt to connect to web1 by name and by IP from another container run without a network specified.
- Explore Bridge Networks
- Create a new bridge network named
test_application
. - Run an
httpd
container namedweb2
in thetest_application
network. - Attempt to connect to web2 by name and by IP from another container within the
test_application
network. - Attempt to connect to web1 from a container in the
test_application
network.
- Create a new bridge network named
- Explore the Host Network
- Run an
httpd
container namedweb3
on the host network. - Attempt to connect to web3 directly from the server.
- Attempt to connect to web3 from another container on the host network.
- Attempt to connect to web1 and web2 from a container on the host network.
- Run an