/docker-dev-phpstorm

Development environment for PhpStorm based on Docker.

Primary LanguageDockerfileMIT LicenseMIT

PhpStorm development with Docker

Development environment for PhpStorm based on Docker, managed with Compose.

Installation

Requirements

  • Docker >= 1.8.3
  • Docker Compose

See Install Docker Compose for more information.

Setup

Clone this repository into ~/PhpstormProjects/docker-dev-phpstorm.

Configuration

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.

nginx

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.

node

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.

Build

Run docker-compose build to fetch and build all containers.

After your containers are built, run docker-compose up -d and start coding!

Containers

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.*

Data persistance

MariaDB data is stored in the data directory.

File and folder permissions

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.

Help

FAQ

Useful commands

Start

$ docker-compose up -d

Stop

$ docker-compose stop

List containers

$ docker-compose ps

Open container bash

$ docker-compose exec nginx /bin/bash

Remove all docker containers and images

Do only execute if you know what you are doing!

$ docker rm $(docker ps -a -q)
$ docker rmi -f $(docker images -q)