Your First Docker Lab

DockerDockerBeginner
Practice Now

Introduction

Hi there, welcome to LabEx! In this first lab, you'll learn the classic "Hello, World!" program in Docker.

Click the Continue button below to start the lab.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL docker(("`Docker`")) -.-> docker/ContainerOperationsGroup(["`Container Operations`"]) docker(("`Docker`")) -.-> docker/ImageOperationsGroup(["`Image Operations`"]) docker/ContainerOperationsGroup -.-> docker/ps("`List Running Containers`") docker/ContainerOperationsGroup -.-> docker/run("`Run a Container`") docker/ImageOperationsGroup -.-> docker/images("`List Images`") subgraph Lab Skills docker/ps -.-> lab-92719{{"`Your First Docker Lab`"}} docker/run -.-> lab-92719{{"`Your First Docker Lab`"}} docker/images -.-> lab-92719{{"`Your First Docker Lab`"}} end

Hello Docker

Now, let's run our first Docker container. We'll use the docker run command to run the hello-world image. This command pulls the hello-world image from the Docker Hub if it is not already present on the local host.

docker run hello-world
Hello Docker

Because of the hello-world image is not available locally, the Docker client first pulls the image from the Docker Hub registry and then runs the image. When the image runs, it prints an informational message and exits.

Then you can run the docker images command again to see that the hello-world image is now present on your local system.

docker images

You can also use the docker ps command to see the hello-world container that was created and then exited.

docker ps -a

Summary

Coungratulations! You have completed your first LabEx Lab.

If you want to learn more about LabEx and how to use it, you can visit our Support Center . Or you can watch the video to learn more about LabEx.

Programming is a long journey, but Next Lab is just one click away. Let's do it!

Other Docker Tutorials you may like