Skip to main content
Docker Basics Tutorial
CHAPTER 19 Beginner

Real-World Docker Projects

Updated: May 15, 2026
30 min read

# CHAPTER 19

Real-World Docker Projects

1. Introduction

Employers do not hire candidates because they have read a book on Docker; they hire candidates who can prove they have synthesized Docker commands into working, production-grade applications. A strong GitHub portfolio is your greatest asset in a DevOps or Backend Engineering interview. In this chapter, we transition from theory to practice by outlining five progressive portfolio projects designed to demonstrate your mastery of containerization.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Synthesize multiple Docker concepts (Images, Networks, Volumes) into cohesive architectures.
  • Build a progressive Docker portfolio to showcase to employers.
  • Understand the architectural diagrams of common enterprise workloads.
  • Translate real-world business requirements into docker-compose.yml configurations.

3. Project 1: The Dockerized Static Portfolio (Beginner)

The Goal: Prove you understand fundamental image creation, web serving, and port mapping. The Architecture:
  1. 1. Frontend: Write a personal resume or portfolio using HTML, CSS, and basic JavaScript.
  1. 2. The Blueprint: Write a custom Dockerfile that utilizes nginx:alpine as the base image.
  1. 3. The Build: Copy your static files into the /usr/share/nginx/html directory during the build process.
  1. 4. Publishing: Build the image using your Docker Hub namespace (username/portfolio:v1), log in to Docker CLI, and push it to a public repository.
  1. 5. The Proof: Include a command in your README.md showing employers how they can run your resume on their own machine with a single line: docker run -p 8080:80 username/portfolio:v1.

4. Project 2: The Containerized Node.js API (Intermediate)

The Goal: Demonstrate you can package a dynamic, server-side language, handle dependencies, and secure the container by running as a non-root user. The Architecture:
  1. 1. The App: Write a simple Node.js Express API that returns a JSON list of users (e.g., [{"id": 1, "name": "Alice"}]).
  1. 2. The Blueprint: Write a Dockerfile utilizing node:18-alpine.
  1. 3. Security: Create a node user group and switch to it (USER node) before the CMD instruction to ensure the API does not run as root.
  1. 4. Optimization: Copy the package.json file and run npm install *before* copying the rest of your application code. This proves you understand Docker Layer Caching!
  1. 5. The Proof: Provide a docker-compose.yml that builds the image locally and exposes port 3000.

5. Project 3: The 3-Tier PHP & MySQL Stack (Intermediate)

The Goal: Prove you can orchestrate multiple containers, isolate networks, and persist data permanently. The Architecture:
  1. 1. The Orchestration: Create a docker-compose.yml file defining three services: web (Nginx), php (PHP-FPM), and db (MySQL).
  1. 2. Networking: Place all three services on a custom backend-net Docker network. Only publish (-p) Port 80 on the Nginx container. The PHP and MySQL containers must remain completely hidden from the host machine.
  1. 3. Data Persistence: Attach a Named Volume to the MySQL container (/var/lib/mysql) to ensure data survives container destruction.
  1. 4. Initialization: Map a schema.sql file to the MySQL auto-initialization directory to automatically create a "Users" table on startup.
  1. 5. The Code: Write a simple PHP script that connects to the MySQL container using the db hostname, inserts a user, and displays the database contents on the screen.

6. Project 4: The Secure Nginx Reverse Proxy (Advanced)

The Goal: Demonstrate enterprise routing, separating public-facing traffic cops from hidden backend microservices. The Architecture:
  1. 1. Backend Services: Deploy two simple Node.js or Python APIs. Service A runs on port 3001, Service B runs on port 3002. Neither service should have published ports (-p).
  1. 2. The Proxy: Deploy an Nginx container. Publish Port 80 (-p 80:80).
  1. 3. The Configuration: Write a custom nginx.conf file and mount it into the Nginx container as a read-only Bind Mount (:ro).
  1. 4. The Routing Rules: Configure the nginx.conf so that if a user visits http://localhost/api1, the traffic is secretly proxied to Service A. If they visit http://localhost/api2, the traffic is proxied to Service B.
  1. 5. The Proof: This proves you understand how to protect backend applications from direct internet exposure using a secure, single point of entry.

7. Project 5: The Automated CI/CD Deployment Pipeline (Advanced)

The Goal: Prove you understand modern DevOps automation. Never manually type docker build again. The Architecture:
  1. 1. The Repository: Push your Node.js or PHP application (from Project 2 or 3) to a GitHub repository.
  1. 2. The Pipeline: Write a GitHub Actions YAML workflow (.github/workflows/deploy.yml).
  1. 3. The Trigger: Configure the workflow to trigger automatically whenever code is pushed to the main branch.
  1. 4. The Build Step: Configure the workflow to use a temporary Ubuntu runner to check out your code and execute docker build.
  1. 5. The Security Step: Add a pipeline step utilizing docker scout to scan your newly built image for critical CVE vulnerabilities. If a vulnerability is found, the pipeline must fail.
  1. 6. The Publish Step: If the scan passes, the pipeline securely logs into Docker Hub using encrypted GitHub Secrets and executes docker push.
  1. 7. The Proof: Your GitHub repository will display a green "Passing" badge, proving to employers that your code is rigorously tested and automatically packaged.

8. How to Present Your Projects

An undocumented project is a useless project.
  • The README: Every GitHub repository must contain a flawless README.md.
  • The "Why": Do not just list the commands to run the code. Explain *why* you made architectural decisions. *"I utilized Alpine Linux to reduce the attack surface. I isolated the database on an internal Docker network to prevent port scanning."*
  • Visuals: Use a free tool like Draw.io to sketch out the Container, Volume, and Network boundaries and embed the image in the README. Visual communication is a senior engineering skill.

9. Summary

In Chapter 19, we transitioned from academic theory to tangible engineering. We mapped out five ascending portfolio projects designed to exercise the entirety of the Docker curriculum. From packaging static resumes into custom Nginx images, to orchestrating complex 3-tier PHP/MySQL networks, and finally automating the entire lifecycle via a GitHub Actions CI/CD pipeline. Completing and documenting these projects proves to employers that you possess the hands-on capability to build, secure, and deploy production container environments.

10. Next Chapter Recommendation

Your portfolio is built. It is time to prepare for the technical interview and plan your career path. Proceed to Chapter 20: Docker Interview Questions and Career Roadmap.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·