🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101

Dockerise a full-stack app

Put an app, its database and a reverse proxy into containers so anyone can run it with one command.

Beginner⏱ 5–8 hoursđŸĒœ 7 stepsDockerDocker ComposeAny web app

What you'll learn

  • ◆Images, containers and layers
  • ◆Multi-stage builds
  • ◆Compose networks, volumes and environment variables

What you'll build

  • ✓docker compose up starts everything
  • ✓Small production image
  • ✓Database data survives restarts
  • ✓Health checks

Step-by-step guide

  1. 1

    Pick an app

    Use one of your projects (for example a Node or Spring Boot API with a database).

  2. 2

    Write a Dockerfile

    Multi-stage: build in a full image (node:20 / maven), copy only the output into a slim runtime image; run as a non-root user.

  3. 3

    .dockerignore

    Exclude node_modules, .git, .env and build output to keep images small and secrets out.

  4. 4

    Compose file

    Services: app, db (postgres:16 with a named volume), optional nginx; depends_on with a healthcheck condition.

  5. 5

    Configuration

    Pass settings through environment variables and an .env file that is not committed.

  6. 6

    Health checks

    HEALTHCHECK in the Dockerfile or compose calling /health.

  7. 7

    Measure

    Compare image sizes before and after multi-stage builds (docker images) and note it in the README.

🚀 Make it stand out

  • +Push images to a registry
  • +Run on a cloud VM
  • +Hot reload in development with bind mounts