Networking with Docker

Docker has some pretty nice networking options, from choosing which ports to expose to concurrently running isolated or bridged networks. It's pretty useful to quickly and easily simulate production environments, create better architectures, and increase container exposure on the network front. We'll see different ways to expose ports, create new networks, execute Docker containers inside them, and even have multiple networks per container.

Getting ready

To step through this recipe, you will need the following:

  • A working Docker installation
  • A sample HTTP server binary (sample code included)

How to do it…

To make a container network port available to others, it first needs to be exposed. Consider any service listening on a port ...

Get Infrastructure as Code (IAC) Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.