Docker Support in PhpStorm

large_v-transDocker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.

With the new Docker integration plugin for PhpStorm, you can add Docker support to existing projects, view logs, manage Docker containers, and debug PHP web applications from right inside PhpStorm.

In this blog post we overview some of the most important features and configurations; for more details please refer to the full tutorial on Docker Support in PhpStorm.


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 for various platforms or the cloud.

You will also need to install the Docker integration plugin in PhpStorm (in Settings /Preferences | Plugins, click the Install JetBrains plugin…).

PhpStorm & Docker Integration Configuration

To start using Docker, the default Docker machine should be launched using the Docker Quickstart Terminal (Windows / Mac OS X, for Linux you need to use a standard terminal executing a sudo docker run hello-world command). At the next steps we’ll need some of the parameters of this machine environment, so we’ll need to run docker-machine env default console command to get all the necessary parameters (Windows / Mac OS X, for Linux you’ll need to use a standard IP address, such as DOCKER_HOST and DOCKER_CERT_PATH:

As soon as we have Docker running (and all the parameters fetched for future use), we can start configuring PhpStorm to work with Docker.

Create a Docker configuration with the + button in Settings / Preferences | Build, Execution, Deployment | Clouds:

We’ll need to provide the configuration name (Docker), API URL (, taken from the previous step), and Certificates folder (/Users/mikhailvink/.docker/machine/machines/default).

Please note that you will need to provide a socket path in the API URL field on Linux machines (unix:///var/run/docker.sock by default).

Next we need to create a new Docker Deployment Run/Debug Configuration in the Run | Edit configurations… menu.

Provide all the necessary parameters on the Deployment and Container tabs:

At this point we are interested in exposing port 80 of the container to be available from our local machine, so we should configure a port binding for that:

There are many ways to create/configure Docker containers and VM images; please refer to the Docker documentation on their official website.

For the purposes of this tutorial we’re making some configuration in the Dockerfile and Apache configuration file, so do have a look at them. You can download the entire project used in this demo or separate config files (apache-config.confDockerfile) which then need to be placed in the project root folder.

Running the Docker from PhpStorm

As all the tools are installed and the integration is configured, the recently created Start Docker Run/Debug Configuration can be launched. The Application Servers tool window will be opened updating you on the provisioning status and current state of all your Docker containers:

As soon as our Docker_Xdebug container’s status turns green, we can check how it works in the browser. You should be able to open it with a URL similar to (http://host:port192.168.99.100 is the IP address of the default Docker machine).

Managing Docker containers and other Docker-related actions in PhpStorm

From the Application Servers tool window, it’s easy to inspect containers and view the running processes. You can also search through logs, start and stop containers, and perform basic container management like creating and deleting containers.

Debugging PHP web application running in the Docker container

The main challenge in getting Xdebug (or Zend Debugger) working with PhpStorm and Docker integration is the correct configuration of the Docker container.

In our case we’re using a Dockerfile (we’ve already shown this config earlier and provided links to download it) to configure the container, including Xdebug-specific parameters, such as:

#Set up debugger
RUN echo "zend_extension=/usr/lib/php5/20131226/" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.remote_enable=1" >> /etc/php5/apache2/php.ini
#Please provide your host (local machine IP) instead of
RUN echo "xdebug.remote_host=" >> /etc/php5/apache2/php.ini

Please note that xdebug.remote_host value should be replaced with your local machine IP address which is visible from the Docker container (where PhpStorm is running, in our case

Don’t forget to re-run Start Docker Run/Debug Configuration so that all the changes are applied.

As soon as all the configs are in place, the debugging process can be triggered by following this tutorial starting with step 2 (start Listening for PHP Debug Connections, set a breakpoint in the source code, and start a debugging session in the browser, reload the current page, debug) to get the debugger up and running in a few moments:

Please have a look at the full tutorial on Docker Support in PhpStorm for more information.

Please share your feedback on Docker support in PhpStorm in the forum, comments to this blog post, or our issue tracker. Thanks!

Develop with pleasure!
JetBrains PhpStorm Team

This entry was posted in Cool Feature, Early Access Program, Tutorial and tagged , , , , , , . Bookmark the permalink.
  • Sebastien Collado

    Nice addition to PhpStorm.
    For the xdebug configuration part, you can use remote connect_back setting if you don’t want to update your Dockerfile each time your IP is renewed :

    • Mikhail.Vink


  • Conrado

    Which version of PHPStorm are using ? I cannot find “Container” tab in my run/debug configuration :( I have only “Container settings” input.

  • manuel raynaud

    Great, next step is the support of docker-compose ?

  • Sam Stha

    Everytime i make changes, I have to restart my container. Is there way to push changes to docker conatainer automatically?

    • nobrandheroes

      Did you ever get this fixed? I would like to know this too.

  • deepinsource

    I run phpstorm 10 on ubuntu 14.04, and have this issue, please help

    Creating container…

    Container Id: 5adabf0065595a41acd7e9bc5545044bb2f73686711da67bf8d8731c04a81b7b

    Starting container…

    Attaching to container…

    Failed to deploy ‘Docker_Xdebug Dockerfile: Dockerfile’: javax.websocket.DeploymentException: The HTTP response from the server [HTTP/1.1 404 Not Found

    ] did not permit the HTTP upgrade to WebSocket

  • Joseph McDermott

    How about running PHP Scripts from within PHPStorm, ie. using the debug tool in top right to actually. Furthermore, how about triggering PHPUnit and gathering code coverage results from within PHPStorm? Doesn’t seem like an obvious way to do this using Docker.