PhpStorm development with Docker
Development environment for PhpStorm based on Docker, managed with Compose.
- Docker >= 1.8.3
- Docker Compose
See Install Docker Compose for more information.
Clone this repository into ~/PhpstormProjects/docker-dev-phpstorm
.
You may need to configure your project and volume paths in docker-compose.yml
.
The project default path is set to ~/PhpstormProjects
.
The data default path is set to ~/PhpstormProjects/docker-dev-phpstorm/data
.
Create the file nginx-projects.conf
(or any other *.conf
file) in your nginx
folder and insert your server
configurations.
The file(s) will be copied into the nginx conf.d
directory.
In order for nginx to run, a default server.js
in the node
directory is executed on startup.
You can change the node entry point in the node/Dockerfile
.
Run docker-compose build
to fetch and build all containers.
After your containers are built, run docker-compose up -d
and start coding!
Container | Name | Port | Version |
---|---|---|---|
nginx | nginx | 8080 | 1.11.* |
node | node | 9016 | 16.* |
mariadb | mariadb | 9010 | 10.7.* |
php (fpm) | php74 | 9074 | 7.4.* |
php80 | 9080 | 8.0.* | |
php81 | 9081 | 8.1.* |
MariaDB data is stored in the data
directory.
Sadly, permissions are a bit of pain right now. Most containers write data with their own www-data
users. Data written
by this user can not be accessed by your host user. You will have to chown
files created by your containers.
It's the same the other way around, containers will not be able to write data in your project directory, unless you grant them access. This can be done by granting read and write access on your projects folder to everyone. Please keep in mind that this is a security risk!
Please let me know if there is an easy solution for this. Current solutions are too hacky.
$ docker-compose up -d
$ docker-compose stop
$ docker-compose ps
$ docker-compose exec nginx /bin/bash
Do only execute if you know what you are doing!
$ docker rm $(docker ps -a -q)
$ docker rmi -f $(docker images -q)