Chapter 5. Network exposure
This chapter covers
- Network container archetypes
- How Docker works with the computer’s network
- How Docker builds network containers
- Ways to customize a container network
- Making containers available to the network
- Discovering other containers
In the previous chapter you read about how to use volumes and work with files in a container. This chapter deals with another common form of input and output: network access.
If you want to run a website, database, email server, or any software that depends on networking, like a web browser inside a Docker container, then you need to understand how to connect that container to the network. After reading this chapter you’ll be able to create containers with network exposure appropriate for the application you’re running, use network software in one container from another, and understand how containers interact with the host and the host’s network.
This chapter is focused on single-host Docker networking. Multi-host Docker is the subject of chapter 12. That chapter describes strategies for service discovery and the role container linking plays in that situation. You’ll need the information in this chapter before any of that will make sense.
A quick overview of relevant networking concepts will be helpful for understanding the topics in this chapter. This section includes only high-level detail; so if you’re an expert, feel free to skip ahead.