In this overview on Docker networking, learn about the container network model (CNI) and how it works with the Docker networking drivers.
- [Instructor] Before we jump in and just start configuring Docker networking, you need a little bit of a foundation, and that's what I'd like to provide you in this video, where we present our Docker Networking Overview. So, at the most basic level you have your containers, and inside your containers you have applications. Well, those applications, they need access to the network. 99.9 percent of the time they need access to the network to do something. So, they connect to the network, and from there where do they go? Well, they might go out to the internet.
Maybe there's inbound applications that need access to the application running in the container, or maybe the application needs access to something out on the internet to do some sort of processing and present some sort of information. Perhaps they need access to go out to data, some sort of data in the data center, could be a database server for example, or some sort of storage system. And then, finally, perhaps they need access to end users, or rather, end users need access to the applications that are running inside the container.
So, hopefully you're getting the point here. The point is that applications running in containers need the network and when you go to configure the network for these types of applications, there's a lot that you need to take into consideration. You need to think about the types of network connections that you wanna make. There are numerous types of networks in Docker that you can configure. It's not just, oh well we provide this application access to the LAN, which goes to the internet. There's a lot more to it than that and these are the types of things that we'll be exploring in this course.
We'll explore the different types of networks that are available to you. We'll discuss how to publish ports, because typically containers run in their own private sandbox area and they have limited access to the network, inbound and outbound, and you specify through publishing the exact ports. You may wanna configure custom DNS settings. You might need to configure load balancing for production applications. You'll need to understand the traffic flow in order to do these types of things and you may need to use logs to troubleshoot network connections that don't always go exactly as planned.
So, this is called the Docker Reference Architecture: Designing Scalable, Portable Docker Container Networks, and we'll put the URL up there on the screen because like I said, I want you to check this document out. It's very long, it might require a little bit of patience while reading. So, carve out some dedicated time to make sure that you can read this entire document, hopefully in one sitting because it kind of does build on itself. So, if we scroll down here, first they point out some of the challenges around configuring microservices and containers.
You know, portability of the container across different networking environments. Service discovery. How do the applications in the containers get access to the services they need as those services are scaled up and down? We talked about load balancing, we talked about security, performance. How do we ensure minimal latency and maximum bandwidth? And scalability. These are all questions that you need to keep in mind as you configure Docker networks. So, now I wanted to show you this diagram.
This is called The Container Networking Model and as you can see here, there are three different containers, outlined by the dotted lines, and Docker says that around those containers you'll find the network sandbox. So, that network sandbox is kinda the configuration of the Docker container's networking stack, however it is defined. So, that's the networking that surrounds the container and then there's this end point. The end point connects the container to the network and this document defines all of these things in here, so like I said, check it out.
And that end point helps maintain the container as it moves, as it's portable, still can access the network. And then that network is not actually the physical network. That is actually whatever type of network that you configure and in the next video I'll be running through the different types of network options you have available to you as you configure Docker networking, and the use case for each one of those. And then, from the network you connect to the Docker Engine, and then you go either through networking drivers, or the IPAM driver to finally reach the networking infrastructure.
That's the physical networking infrastructure on the bottom. So, what are these networking drivers and IPAM drivers? Well, if we scroll down a little bit on this diagram, Docker defines these for us. So, there are two different types of networking models. Docker has its Container Networking Model and it makes it very open, and pluggable, so that you can configure whatever type of networking drivers you wanna use. It provides some, but as the Docker slogan goes, the batteries are included but are also replaceable.
So, you can replace the batteries, or the network that they give you with a variety of different options. So, there's the Docker Networking Drivers model and there are native networking drivers that are included, and then there are remote networking drivers that are provided by third parties. Then there's also the IPAM drivers. Docker has native IPAM, which is IP Address Management drivers, and some of those are included, but there are also remote IPAM drivers that you can get from third parties as well.
Now, Docker says that you need to understand the Container Networking Model and how it interfaces with the Docker Engine, as well as the network and IPAM drivers. So, I encourage you to check this document out and read through it to thoroughly understand the Container Networking Model, and the different type of networking drivers that are available to you before we jump into configuring those in the upcoming videos.
- Configuring Docker networking
- Types of container networks
- Creating a bridge and overlay network
- Configuring DNS, load balancing, and host networking
- Troubleshooting Docker networking
- Identifying external network ports
- Using Docker logs to analyze networking issues