0
0
Dockerdevops~15 mins

Running a container with docker run - Mini Project: Build & Apply

Choose your learning style9 modes available
Running a container with docker run
📖 Scenario: You want to run a simple web server inside a Docker container on your computer. This will help you understand how to start containers using the docker run command.
🎯 Goal: Learn how to run a Docker container using the docker run command with specific options to start a web server and expose it to your computer.
📋 What You'll Learn
Use the official nginx Docker image
Run the container in detached mode
Map port 8080 on your computer to port 80 in the container
Name the container mynginx
💡 Why This Matters
🌍 Real World
Running containers is how many developers and system administrators deploy applications quickly and consistently on any machine.
💼 Career
Knowing how to use <code>docker run</code> is a fundamental skill for DevOps roles, cloud engineers, and software developers working with containerized applications.
Progress0 / 4 steps
1
Pull the nginx image
Write the docker pull nginx command to download the official nginx image from Docker Hub.
Docker
Need a hint?

Use docker pull nginx to get the image from Docker Hub.

2
Run nginx container in detached mode
Write the docker run command to start a container named mynginx from the nginx image in detached mode.
Docker
Need a hint?

Use docker run --name mynginx -d nginx to start the container in the background.

3
Map port 8080 to port 80
Modify the docker run command to map port 8080 on your computer to port 80 inside the container.
Docker
Need a hint?

Add -p 8080:80 to map ports.

4
Verify the container is running
Write the docker ps command to list running containers and verify mynginx is running.
Docker
Need a hint?

Use docker ps to see running containers.