Containerization

1. Dockerizing a PHP Web Application

🎯 Goal

Learn how to containerize a PHP web application using Docker, deploy it to Docker Hub, and share it with others for seamless deployment across different environments.

📋 Prerequisites

Before beginning this exercise, you should:

  • Have PHP installed on your local machine (version 7.4 or higher)
  • Have Docker Desktop installed and currently running
  • Have a Docker Hub account (free at https://hub.docker.com)
  • Have basic understanding of command line operations
  • Have the PHP application source files ready (either copy from the Appendix at the end of this tutorial or use your own PHP files)

📚 Learning Objectives

By the end of this exercise, you will:

»

2. Deploy Docker Containers from Docker Hub to Azure VM

🎯 Goal

Learn how to provision an Azure Virtual Machine with Docker pre-installed, then deploy containers from Docker Hub including both public images (nginx) and your own containerized applications from the previous exercise.

📋 Prerequisites

Before beginning this exercise, you should:

  • Have an Azure subscription with credits available
  • Have Azure CLI installed locally (version 2.0 or higher)
  • Have completed the previous Docker exercise (PHP application pushed to Docker Hub with multi-architecture support)
  • Have basic understanding of Linux command line
  • Have SSH client available (built-in on Mac/Linux, use PowerShell on Windows)

⚠️ Note: If you haven’t built your Docker image with multi-architecture support, refer to Step 3 in the previous tutorial for instructions using docker buildx

»

3. Production Multi-Container Setup with Docker Compose

📚 Learning Objectives

After completing this exercise, you will be able to:

  • Design and implement a production-grade multi-container architecture
  • Configure nginx as a reverse proxy for PHP-FPM
  • Use Docker Compose to orchestrate multiple containers
  • Implement container networking and service dependencies
  • Apply security best practices for production deployments

🔧 Prerequisites

  • Docker Desktop installed and running
  • Basic understanding of web servers and PHP
  • Completed Exercise 1 (Dockerizing a PHP Web Application)
  • Source files from Exercise 1 (src/ directory with PHP application)

📋 Architecture Overview

In this exercise, we’ll create a production-ready setup with:

»