Simple PHP development environment with Docker
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHP Development Docker Environment

This repository contains a basic configuration for a development environment for a typical AMP stack (Nginx, MySQL and PHP). Project files stored in the public folder are served by Nginx.

Based on Master Zend Framework blog post.



Starting the environment

  • $ docker-compose up

Note: if you don't want to see the logs you can run docker-compose in daemon mode by appending the -d flag to the command.

After starting, you can access the server through the browser.

  • http://localhost:8080

Getting information about the containers

It is useful to know what containers are running, their names, expose ports, ...

  • $ docker ps

SSHing into containers

Sometimes it might be useful to access the actual container (for example, to import a database).

  • $ docker exec -i -t YOUR_CONTAINER_NAME /bin/bash

Accessing phpMyAdmin

phpMyAdmin is served by default in the port 8090.

  • http://localhost:8090

Using a different PHP version

By default it is used the PHP 5.6 but if you want use a diffent version just edit the version number in the ./docker/php/Dockerfile file.

For more information about Docker images of other PHP versions check the PHP Docker Hub.

See volumes and removing them

A new volume is created for persistently storing the database files. To list the existing volumes:

  • $ docker volume ls

To remove a volume:

  • $ docker volume rm YOUR_VOLUME_NAME