From the course: Docker Essential Training

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Exposing container ports between containers

Exposing container ports between containers - Docker Tutorial

From the course: Docker Essential Training

Exposing container ports between containers

- [Instructor] Docker makes it easy to expose network ports within containers to other containers, or even to your local machine. Let me show you what I mean. We have our two terminals from last time, each running a container. The top terminal is running container-a and the bottom is running container-b. In container-a, I'm going to use a program called Netcat, or nc, to start a really simple TCP server on port 80. The server will do nothing but echo whatever text it receives. To do that, I'll first run ifconfig eth0 to show our container's IP address, which is here. Then I'll run nc -l -p 80 to start the server. We won't see anything after we run this because it's waiting for someone or something to send input to it. In container-b, I'll connect to container-a's server with Telnet. Telnet is a program that allows you to talk to servers behind TCP ports as if they were terminals. We'll need to install it first. To do…

Contents