Docker in PhpStorm

Enable Docker in PhpStorm – Deploy PHP App in Docker

Everybody is talking about Docker this days. Trust me, you should too. It’s the future for running application. Deploying your codes or application in a Docker container is going to be a very popular. So let’s see how to enable Docker in PhpStorm so you can debug your application from PhpStorm to Docker container easily.

I am assuming that you already have Docker installed on your machine. Note: in this article I am using Ubuntu OS. So adjust things accordingly. Also you have PHPStorm installed too. If I am correct then read below, otherwise you need to install PhpStorm and Docker both to make this work.

First, go to Settings/Preferences (Ctrl + Alt + S), then go to Build, Execution, Deployment | Docker

You will see “Connection successful”. But if you do it first time, you may see a “cannot connect to docker daemon at unix ///var/run/docker.sock” error. If you see this error, mostly it’s related to permission. You need to add current Ubuntu user to docker group with the following command.

sudo usermod -aG docker $USER

After adding yourself to the docker group, do the configuration step again and your PhpStorm will get connected with your Docker daemon.

More about Docker, PhpStorm

If you face any trouble to enable Docker in PhpStorm, please write a comment below.

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.