Prerequisites
Docker installation
First of all, you'll need to install Docker and related tools so that you can take advantage of the Docker integration in PhpStorm. Please refer to the Docker documentation to get more information about the installation process:
- Installing Docker engine on Windows
- Installing Docker engine on Mac OS X
- Installing Docker engine on Linux (Ubuntu, other distributions-related instructions are available as well)
- You can also install Docker on various cloud platforms (e.g. here are tutorials on installing Docker on Amazon EC2, Google Cloud Platform, and Microsoft Azure).
Docker integration plugin installation
You will also need to install the plugin in PhpStorm. Open Settings (Preferences) | Plugins, and click the Install JetBrains plugin... button:
Search for Docker and install the Docker Integration plugin by using the context menu.
Restart the IDE to complete the installation of the plugin.
PhpStorm & Docker Integration Configuration
At this point you have Docker and Docker plugin for PhpStorm installed, so we can start with integration configuration.
Launching default docker machine and getting necessary parameters
- Open the "Docker Quickstart Terminal"
- Docker will launch a default VM providing output in the console:
- Run docker-machine env default to get necessary parameters, as we'll need them later for configuration of the PhpStorm (such as DOCKER_HOST and DOCKER_CERT_PATH):
Configuring PhpStorm to work with Docker
- Open Settings / Preferences | Build, Execution, Deployment | Clouds and create Docker configuration with a + button:
You need to provide the configuration name (Docker in our case), API URL (https://192.168.99.100:2376 in our case, taken from the previous step console output, please note the protocol change), Certificates folder (/Users/mikhailvink/.docker/machine/machines/default in our case):
- Apply the configuration and close the Settings / Preferences dialog.
- Create a new Docker Deployment Run/Debug Configuration invoking the dialog from the Run | Edit configurations... menu: