Run Your First Container

DockerDockerBeginner
Practice Now

Introduction

Welcome to the "Run Your First Container" challenge! You've already learned how to run the hello-world container. Now, let's take it a step further and run a different, interesting container. In this challenge, you'll use your newly acquired Docker skills to run a container that displays a fun message.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL docker(("Docker")) -.-> docker/ContainerOperationsGroup(["Container Operations"]) docker/ContainerOperationsGroup -.-> docker/run("Run a Container") subgraph Lab Skills docker/run -.-> lab-388943{{"Run Your First Container"}} end

Run a New Container

Tasks

Your task is simple:

  1. Run a Docker container based on the docker/getting-started image.

Requirements

To complete this challenge, you must:

  1. Use the docker run command to start the container.
  2. Use the image docker/getting-started.
  3. Execute the command in the ~/project directory.

Example

When you successfully run the container, you should see output that includes some information about Docker.

Don't worry if you see a warning message about the /docker-entrypoint.d/ directory not being empty.

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/10/29 09:26:17 [notice] 1#1: using the "epoll" event method
2024/10/29 09:26:17 [notice] 1#1: nginx/1.23.3
2024/10/29 09:26:17 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
2024/10/29 09:26:17 [notice] 1#1: OS: Linux 5.15.0-56-generic
2024/10/29 09:26:17 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/10/29 09:26:17 [notice] 1#1: start worker processes
2024/10/29 09:26:17 [notice] 1#1: start worker process 31
2024/10/29 09:26:17 [notice] 1#1: start worker process 32

You can open a new terminal window to verify that the container is running by using the docker ps command.

docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS     NAMES
f3f3b3b3b3b3   docker/getting-started   "/docker-entrypoint.โ€ฆ"   1 minute ago   Up 1 minute   80/tcp   festive_mendel

Note: Don't exit the terminal before you click the Continue button.

โœจ Check Solution and Practice

Summary

In this challenge, you've expanded your Docker skills by running a new container. You've used the docker run command to start a container from the docker/getting-started image, which displays some introductory information about Docker. This exercise reinforces your understanding of how to use Docker to run containers and introduces you to a new, informative Docker image. It's a great way to see how Docker can be used to quickly access and run pre-configured applications. Keep exploring different Docker images to continue expanding your containerization skills!