HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • How to earn XP

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 09 Nov 2026, 10:59 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowth
    DockerWorking towardsDocker
    0%

    0 of 9 steps done · +100 XP · +50 SHARP when it is yours

    1. 1Why Docker Fixes Setup Pain4 min · +10 XP · +5 SHARP
    2. 2Write Your First Dockerfile4 min · +10 XP · +5 SHARP
    3. 3Build And Run Your Image4 min · +10 XP · +5 SHARP
    4. 4Keep Data With Volumes4 min · +10 XP · +5 SHARP
    5. 5Add Compose For App Plus Database4 min · +10 XP · +5 SHARP
    6. 6Handle Environment Variables Safely4 min · +10 XP · +5 SHARP
    7. 7Make The Repo Recruiter-Ready4 min · +10 XP · +5 SHARP
    8. The check10 questions, 7 to pass · +10 SHARP
    9. Hand in the taskA project that uses the skill
    10. Skill and certificate+100 XP · +50 SHARP
    Lesson 3 of 7 4 min

    Docker

    Build And Run Your Image

    • +10 XP for this lesson
    • +100 XP when the skill is proved
    • 3 learning it right now
    In 30 seconds
    • Build an image from your Dockerfile and give it a clear name.
    • Run that image as a container and publish the app port to your laptop.
    Debug the first failures using logs, port checks, and rebuilds.
    Key point

    One loop

    The loop is: build an image, run a container, open the app, fix errors, rebuild. Your Dockerfile is not proven until the app works from the image on your laptop.

    An image is the packaged app. A container is a running copy of that image.

    Your to-do

    Build the image

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    docker build -t campus-events .
    Example

    Run a web app

    Most web apps listen on a port inside the container. Your browser needs a host port on your laptop mapped to that container port.

    This example maps laptop port 3000 to container port 3000. Change the port if your app uses 5000, 8000, or 8080.

    docker run --name campus-events-web -p 3000:3000 campus-events
    
    # Then open:
    # http://localhost:3000

    What port mapping means

    The left side is the host port. That is the port on your laptop. The right side is the container port. That is where the app listens inside Docker.

    If you use -p 8080:3000, you open http://localhost:8080, even though the app inside the container still listens on 3000.

    docker run -p 8080:3000 campus-events
    Tip

    Name your container

    Use --name while learning. It makes logs and cleanup easier because you do not need to copy a random container ID.

    If you run the same name twice, Docker will complain. Remove the old container or choose a new name.

    docker logs campus-events-web
    
    docker rm campus-events-web
    Common mistake

    Rebuild after changes

    Changing your app files does not magically change an image you already built. The image is a snapshot made at build time.

    If you edit code, dependencies, or the Dockerfile, build again before you run again.

    docker build -t campus-events .
    docker run --name campus-events-web -p 3000:3000 campus-events
    Your to-do

    Debug first failures

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    docker logs campus-events-web
    
    docker ps -a
    
    docker rm campus-events-web
    Your to-do

    Do this now

    Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.

    0 of 5 done

    docker build -t your-project-name .
    docker run --name your-project-web -p 3000:3000 your-project-name
    Sources

    Checked against the current documentation on 21 September 2026.

    • Dockerfile reference · docs.docker.com
    • Writing a Dockerfile · docs.docker.com
    • Define services in Docker Compose · docs.docker.com

    Quick check

    0 of 2 right
    1.You changed app code after building the image. What should you do before testing that change in Docker?
    2.Your command is docker run -p 8080:3000 app. Which URL should you open on your laptop?

    Answer the quick check to finish this lesson.

    ← Lesson 2Skip to lesson 4 →
    Docker
    Working towards
    Docker +100 XP

    0 of 7 lessons done · proved by a project that uses the skill

    See the track