Apache MySQL PHP PHPMyAdmin Containerized with Docker

PHP / Apache / MySQL stack has a dominant market share on internet content management systems and web applications, and with so many developers using these technologies, there is a great deal of interest in modernizing the way they use them from local development through to production. Today we’ll look at several ways to containerize and connect PHP, Apache, and MySQL together while demonstrating some tips, tricks, and best practices that will help you build and deploy your PHP applications in a modern way!

Project directory structure


apache > Dockerfile

php > Dockerfile



public_html > index.php

Run the application inside Docker

sudo docker-compose up

Access PHPMyAdmin

You can now navigate to localhost:8081 to open PHPMyAdmin.

The default MySQL installation only creates the “root” administrative account (user: root, pass: root)

Create new databases, users using PHPMyAdmin or using the command docker-compose exec.


GitHub Repository


Sources :

Digital Ocean : https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose

Docker docs: https://docs.docker.com/engine/reference/commandline/exec/

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Open chat
Powered by