0

I'm using Windows 11 and PhpStorm (2023.3.2). PhpStorm connects to a WSL2 Ubuntu (22.04 jammy). This Ubuntu has Docker engine installed, it is used for builds and composing dev servers.

PhpStorm is connected to the docker service using WSL2 connection, as :

enter image description here

This configuration works fine and allows me to build and compose with PhpStorm from Windows host. But when I composer up a container, it is always considered as an orphan container in PhpStorm.

enter image description here

The first thing I tried was to check already existing topics about this issue, but I found none. I tried keywords like :

  • docker phpstorm orphans WSL
  • docker phpstorm orphan containers
  • docker phpstorm ubuntu WSL

So, I started by simplifying my current docker-compose.yml file using a simple image and configuration.

Here are my simplest possible try, which I will base my next tests :

services:
  pgAdmin:
    image: dpage/pgadmin4
    ports:
      - 5431:80
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PG_USERNAME-AAA}
      PGADMIN_DEFAULT_PASSWORD: ${PG_PASSWORD-BBB}

Which is displayed as : enter image description here

So the problem doesn't seems to be related to the content of the docker-compose.yml but rather my PhpStorm configuration. My PhpStorm deployment configuration is default, but here it is, just in case :

enter image description here

I tried to docker compose up -d from shell, the result is the same : orphan container in PhpStorm :

enter image description here

Listing my docker containers from the shell didn't triggered any warning about orphan elements :

enter image description here

Could all of this be related to a docker PhpStorm module bug ? Since I didn't get any error from the console commands.

A quick scheme of my environment and a resume :

enter image description here

PhpStorm connects from Windows 11 to WSL2 Ubuntu, this Ubuntu has docker installed. PhpStorm connect itself to the remote WSL2 docker. Everything works (building, env files, compose with options), the only issue is that all container are considered as orphans in PhpStorm.

1 Answer 1

0

I had exactly the same error in my setup. Everything working perfectly, except for the orphans containers warning.

I use Docker Desktop for Windows, along with WSL2. What I could notice is that when running the container, PHPStorm was using docker.exe (Docker Desktop installs Docker on both Windows and Linux distribution)

So, the correct way is to use Remote Development from PHPStorm and connect to WSL (In the IDE selection, download a second instance of PHPStorm)

A new window will open with your project, and you will notice that the containers will no longer appear as orphaned because it will now use docker.sock from Linux

I hope it has been useful to you

Not the answer you're looking for? Browse other questions tagged or ask your own question.