Skip to main content

Working with Docker Networks

Hands-On Lab

 

Photo of Travis Thomsen

Travis Thomsen

Course Development Director in Content

Length

01:00:00

Difficulty

Beginner

In this Live Environment, you’ve been asked by your manager to create a new network that all new Docker containers will be using. The network will be called app-bridge. After creating it, you will need to verify that it works by spinning up a nginx container that will use the new network.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Working with Docker Networks

Introduction

In this hands-on lab, we're going to create a new network that all new Docker containers will be using. The network will be called app-bridge. After creating it, we will verify it works by spinning up a nginx container that will use the new network.

Solution

Open a terminal window and log in via SSH using the credentials on the lab page.

Create a Docker Network

  1. Create the network:

    docker network create app-bridge
  2. Verify it was created:

    docker network ls

Create the Docker container

  1. Create the container:

    docker run -dt --name my-app --network app-bridge nginx:latest
  2. Make sure the container is running:

    docker ps

Conclusion

Congratulations on completing this hands-on lab!