Using the RUN Instruction in Dockerfiles
📖 Scenario: You are creating a Docker image for a simple web application. You need to install necessary packages inside the image using the RUN instruction in a Dockerfile.
🎯 Goal: Build a Dockerfile that uses the RUN instruction to install curl and git packages on an Ubuntu base image.
📋 What You'll Learn
Use the official Ubuntu base image
Use the
RUN instruction to update package listsUse the
RUN instruction to install curl and gitPrint the installed versions of
curl and git to verify installation💡 Why This Matters
🌍 Real World
Dockerfiles are used to create images that package applications and their dependencies. Using RUN instructions lets you install software inside these images.
💼 Career
Understanding RUN instructions is essential for DevOps roles that involve containerization and building Docker images for deployment.
Progress0 / 4 steps