0
0
Dockerdevops~30 mins

What is Docker - Hands-On Activity

Choose your learning style9 modes available
What is Docker
📖 Scenario: Imagine you want to share a small app with your friend. But your friend has a different computer setup. Docker helps you package your app so it runs the same everywhere.
🎯 Goal: Learn the basic idea of Docker by creating a simple Dockerfile that sets up a container with a message.
📋 What You'll Learn
Create a Dockerfile with a base image
Add a command to print a message
Build the Docker image
Run the Docker container to see the message
💡 Why This Matters
🌍 Real World
Docker is used to package apps so they run the same on any computer or server, avoiding setup problems.
💼 Career
Knowing Docker is essential for developers and DevOps engineers to build, share, and deploy applications efficiently.
Progress0 / 4 steps
1
Create a Dockerfile with a base image
Create a file named Dockerfile and write the line FROM alpine to use the Alpine Linux base image.
Docker
Need a hint?

Use the FROM instruction to specify the base image.

2
Add a command to print a message
Add the line CMD ["echo", "Hello from Docker!"] below the FROM alpine line in the Dockerfile.
Docker
Need a hint?

Use CMD with JSON array syntax to specify the command.

3
Build the Docker image
Run the command docker build -t hello-docker . in the terminal to build the image named hello-docker from the current directory.
Docker
Need a hint?

Use docker build with -t to name your image.

4
Run the Docker container to see the message
Run the command docker run hello-docker in the terminal to start the container and see the message Hello from Docker!.
Docker
Need a hint?

Use docker run followed by the image name to start the container.