Docker Fundamentals

Lesson 6 of 6

Final Project: Containerize a Web App

Time to package a real application with Docker.

Requirements

  1. Write a Dockerfile for an existing app of yours (or a simple new one), ordering instructions so dependency installation is cached separately from your source code.
  2. Build the image and run it as a container, confirm it works by accessing it from your browser or a REST client.
  3. Add a second service the app depends on (a database, cache, etc.) using a docker-compose.yml file.
  4. Use a named volume so that service's data survives docker compose down and docker compose up again.
  5. Pass at least one piece of configuration in via an environment variable rather than hardcoding it.

Stretch goals

  • Add a .dockerignore file to keep node_modules/.git/etc. out of your image.
  • Use a multi-stage build to keep the final image small.
  • Push your image to Docker Hub.

Submit your repository link below when you are done, an instructor will review it before you can mark this lesson complete. Good luck! 🚀

This lesson ends in a project. Build it on your own machine, there's nowhere to submit it here, but the brief above is everything you need.