Based on the official docker images we did build a setup for easy setting up a local development environment for your php based web projects. This setup with bind mounts works on mac only due to different file permission and ownership handling on mac and linux. See for details:
Based on the official php image we added some common things you need in projects based on symfony, magento or contao for example.
Comes with some comfort stuff which is often used when works needs to be done inside the container and an optimized php ini for development.
The container adjusts the www-data user to match your host user id, so you want get permission problems. It reads the user and group id from your volume mount in the container which should be by default: /var/www/share/project
.
If you want to changed that pass the env var: PROJECT_PATH
. Our docker compose examples work out of the box.
-
Pre installed and activated extensions:
- iconv
- gd
- xml
- intl
- redis
- pdo_mysql
- zip
- mcrypt (sodium for php 7.2)
- xdebug
- exif
-
Tools
- Vi(m)
- git
- composer globally installed
- globally installed symfony var dumper
- gosu
In your docker compose file use:
image: ctsmedia/php:7.2-fpm
instead of
image: php:7.2-fpm
- SSL enabled
- Zero config for connection to php fpm
- http2 enabled
Coming soon
See the compose-examples dir for some examples getting you started within minutes. Variable compositions of php 7.0, 7.1, 5, apache, mysql or mariadb, phpmyadmin and more.
xdebug is not enabled by default due tue performance reasons expecially on mac. To enable it pass the following env variable:
ENABLE_XDEBUG=true
for example:
docker run -it -e ENABLE_XDEBUG=true ctsmedia/php:7.2-fpm bash
See example docker compose files accordingly.
- Grab one of the example composes files and put it into you project root / repository
- Rename it to
docker-compose.yml
- Adjust the compose file to your likings (documentation inside)
- Run
docker-compose up -d
- Access the http container (in general http://localhost:80, you can use
docker ps
to find the port. )
- Adjust the Dockerfile to your likings
- Build the image. Replace the tag and php version
docker build -t ctsmedia/php:7.2 --build-arg PHP_VERSION=7.2 .
:wq