How to configure PHPStorm to work with native Docker for mac

In the past few days I have tried to configure PHPStorm with Docker for mac, and I’ll list how you can do that cause sadly the documentation depend on the old docker version

1-You need to install the plugin














2- Next you will have to restart PHPStorm, mean while you will need to install a program called socat using homebrew using the following command

brew install socat

3- You will have to execute the following command every time you need want to use docker with PHPStorm

socat -d -d -lf /tmp/socat.txt TCP-L:2376,fork UNIX:/var/run/docker.sock

You can read more about socat from this link.

4- Now you will have to configure PHPStorm like the following


3 4 5








  • You will need to add the server, configure the URL, by default it will use the old URL for Docker toolbox, and since it cant read the Unix socket which Docker for mac use, we use socat to redirect the URL to the socket.
  • You will need to add the full path for docker-compose command , not sure why but PHPStorm didn’t find it.
  • The certification field should be removed, as this was related to the old Docker toolbox and no need for it any more.

5- To configure the debugger you should check do the following


6 7 8











for me, my project depend on a docker-compose.yml file, so I choose that one.

6- Make sure that you can start / stop Docker, so from the bottom toolbox you will find the Docker icon, clicking on it will open it and clicking on the Run button should show the images/containers that you have like


9 10


7- Run the debugger (running docker-compose) can be done like the following


And it will run docker-compose and create the image for you, and from there you can find many valuable information about your container



Hopefully this will change later, and it will be much simpler if (and only if) PHPStorm team found a better way to implement it.



  • MirM says:

    Thank you very much for this, I have notice that if you have a .env file and docker-compose.yml is outputting environments, it does not work as it should

    The .env file contains

    The docker-compose.yml contains
    APP_ENV: “${APP_ENV}”

    PHPstrom does not import the value of local

    • Zaher says:

      In general `.env` files has nothing todo with the environment vars you add to your `docker-compose.yml`.
      Cause based on the definition when you set a value in the environment it will set it on the image as a system environment value like when you add it to your bashrc, meanwhile the `.env` file is only related to Laravel ( if am not mistaken you are talking about the environment file in laravel, other wise you need to clarify more).

  • MirM says:

    Also every time I deploy, my database is getting whipped. Seems the containers get deleted, and rebuilt so I’m loosing my dev data.

    • Zaher says:

      you will need to define a volume to your database container which can be used as the persistent place, if you like share your `docker-composer.yml` file as gist ( ) and I’ll be happy to help.

      or you can check this file and see how to define your database image and the volume so that it will not delete your database every time you run your containers.

  • Yorick H says:

    Have you managed to talk to php executable inside a docker container from phpstorm? We are trying to get phpunit test running it’s own dedicated container from inside PHPStorm.

    Anyway thank you for this post, I hope the plugin is getting updated to support native on mac. In the meantime, your post is making my life a little bit easier without needing to constantly lookup and save commands.

  • SomeOne says:

    You could at least mention the original post you copied this from:

    • Zaher says:

      If you look closely at the link you put at the bottom you will notice that he mentioned my article as a reference ..

      so basically he is the one who copied my post and used my images not otherwise.

  • Couldn’t go through this because phpstorm seems to run npm install. Had to revert to remote debugging with

    • Zaher says:

      not sure I follow up with you here, running npm install will be related to the Dockerfile that you have.
      This article talked about the general situation and was not specific to nodejs or PHP, if you share your Dockefile I might be able to help, though am not that expert with Docker

3 Trackbacks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: