Docker PHP Tutorial

a Tutorial Series for PHP Developers

Docker PHP Turorial

This page collects all articles that have been published in my tutorial series on developing PHP on Docker. You can find all code samples in the "Docker PHP Tutorial" repository on Github. If you want to follow along when new articles are being published, I'd recommend to

FYI: Some tutorials provide a video with additional information. There is a YouTube playlist available containing all those videos.

Published parts of the Docker PHP Tutorial

Setting up PHP, PHP-FPM and NGINX for local development on Docker

A primer on Docker. What is Docker? How to install it / transition from Vagrant? How to interact with containers? How to organize multiple services (php-cli, php-fpm, nginx) via docker-compose?

👉 Setting up PHP, PHP-FPM and NGINX for local development on Docker (2018-07-08)

Structuring the Docker setup for PHP Projects

Running a battle-tested development infrastructure for PHP developers in Docker. How to organize the docker folder structure (e.g. shared scripts for containers)? How to establish a convenient workflow via make?

👉 Structuring the Docker setup for PHP Projects (2019-05-20)

Docker from scratch for PHP 8.1 Applications in 2022

An update of the previous article with the learnings of the past 3 years:

  • simplify the setup
  • add more containers (redis, mysql, workers)
  • prepare for additional environments (CI, production)

👉 Docker from scratch for PHP 8.1 Applications in 2022 (2022-03-21)

PhpStorm, Docker and Xdebug 3 on PHP 8.1 in 2022

An update of the previous article on setting up PhpStorm (Part 2) using the latest PHP version (PHP 8.1) as well as the latest Xdebug version (3). The article also covers additional debugging challenges (from the browser, from the CLI, from a long running worker process).

👉 PhpStorm, Docker and Xdebug 3 on PHP 8.1 in 2022 (2022-03-22)

Run Laravel 9 on Docker in 2022

A step-by-step walk through to set up a new Laravel 9 project on the docker setup of this tutorial, using a couple of common Laravel components (Commands, Controllers, Queues, Databases).

👉 Run Laravel 9 on Docker in 2022 (2022-03-23)

Set up PHP QA tools and control them via make

Set up some PHP QA tools like phpcs, phpstan, etc. in the dockerized PHP application and provide make targets to run them either in parallel or individually.

👉 Set up PHP QA tools and control them via make (2022-04-25)

Use git secret to encrypt secrets in the repository

Set up git secret to encrypt and store secrets directly in a git repository. All required tools are set up in Docker and their usage is defined via make targets.

👉 Use git-secret to encrypt secrets in the repository (2022-04-25)

Create a CI pipeline for dockerized PHP Apps

Create a CI pipeline using the dockerized setup introduced in the previous tutorial that can be executed on any CI provider. Concrete examples for Gitlab Pipelines and Github actions are included.

👉 Create a CI pipeline for dockerized PHP Apps (2022-04-25)

A primer on GCP Compute Instance VMs for dockerized Apps

Getting started with the Google Cloud Platform (GCP) as infrastructure provider for a container registry to push and pull docker images as well as for virtual machines to run dockerized applications.

👉 A primer on GCP Compute Instance VMs for dockerized Apps (2022-06-20)

Deploy dockerized PHP Apps to production on GCP via docker compose

Introduce a prod environment to build docker images that are then deployed "to production" on a GCP VM to be executed via docker compose as a proof-of-concept.

👉 Deploy dockerized PHP Apps to production on GCP via docker compose (2022-06-29)

Create a production infrastructure for dockerized PHP Apps on GCP

Create a production infrastructure for a dockerized PHP application on GCP using multiple VMs and managed services for redis and mysql.

👉 Create a production infrastructure for dockerized PHP Apps on GCP