Difficulty: beginner
Estimated Time: 45-60 minutes

BoxBoat Logo

First Docker Lab - Intro To Docker

In this lab we will cover:

  • Running Containers
  • Executing commands inside containers
  • Host and container processes
  • Networking
  • Running a real application

Please email feedback to: [email protected]

Congratulations, you've just gotten your first expose to Docker! Docker is extremely powerful, let's dive into a few more advanced use-cases in our next lab.

First Docker Lab

Step 1 of 5

Hello World


Welcome to the BoxBoat Bootcamp! For our labs, we utilize Katacoda. Katacoda is a platform that enables you to run Docker in your web browser. Each lab has multiple steps where we'll explain concepts and how you can utilize them in Docker. In the future, if you want to experiment with Kubernetes, you should check out Katacoda's Docker playground.

Our Katacoda environment is a lightweight Linux distribution where we can run pretty much whatever we want. Katacoda simplifies the process by allowing you to click on commands to execute them. For example:


You can click on that, and it will execute ls inside the environment.

You can also view open ports, and even edit files. We will be using this platform for the all of our Kubernetes labs.

We strongly recommend that you use a text editor on your host to edit and save files ( VS Code and Atom are excellent and free ). You will receive a copy of all lab files we use at the conclusion of the training.

Hello World

Right now, we have a pristine Docker environment. We can check that by looking for running containers and stored images:

docker container ls

docker image ls

$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              16508e5c265d        6 months ago        84.1MB
redis               latest              4e8db158f18d        7 months ago        83.4MB
weaveworks/scope    1.9.1               4b07159e407b        7 months ago        68MB
alpine              latest              11cd0b38bc3c        8 months ago        4.41MB

One interesting thing is this environment is actually Docker in Docker. That's why we are seeing a few images actually here.

Ubuntu is what it sounds like. Redis is a session cache. weaveworks/scope lets you monitor applications and build a service map. Alpine is an extremely lightweight Linux distribution.

Running your first application is very easy:

docker container run hello-world

After we run this command runs, a few things happen:

  1. Docker checks to see if the image called hello-world is available locally
  2. Docker pulls the hello-world image from Docker Hub
  3. Docker creates a container based on the hello-world image
  4. Docker runs the newly created container

Now that we ran our Hello World container, let's take another look at our system:

docker container ls

docker image ls

We don't see any containers, why is that?

We do see that Docker downloaded our Docker image.

We can actually see our container by passing -a

docker container ls -a

We can see our container based on the hello-world image is there. What is its state? How did it get that name?

We can run a more advanced container that is long-lived:

docker container run -d -p 8080:80 --name my-nginx nginx

This tells Docker to do a few things:

  1. Create a container from the nginx image
  2. Run in detached more (-d)
  3. Publish port 8080 on the host, and forward that traffic to port 80 on the container
  4. Name the container my-nginx

We can now check out our environment again:

docker container ls

docker image ls

Now we can see our NGiNX container running, and also see that Docker pulled the proper image as well.

One command that we will see very often is inspect. This works on almost every Docker object. It gives you additional information about the object. For example:

docker container inspect my-nginx

You'll be able to see all of the configuration information about the Docker container, which is very useful for debugging.

Finally, let's get rid of our Docker image:

docker container stop my-nginx

docker container rm my-nginx