Docker and SSH for development with phpStorm

I am trying to setup a small development environment using Docker. phpStorm team is working hard on get Docker integrated for remote interpreter and therefore for debugging but sadly is not working yet (see here). The only way I have to add such capabilities for debugging is by creating and enabling an SSH access to the container which works like a charm.

Now, I have read a lot about this and some people like the one on this post says is not recommended. I have read others which says to have a dedicated SSH Docker container which I don’t get how to fit on this environment.

  • Exposed port shows as filtered when using nmap
  • war-file as a part of container or shared folder when running docker
  • How to know the reason why a docker container exits?
  • Build docker image fail : Exiting on user command
  • What benefits does Docker Compose have over Docker Swarm and Docker Stack?
  • How to get a docker image to run an executable
  • I am already creating a user docker-user (check repo here) for certain tasks like run composer without root permissions. That could be used for this SSH stuff easily by adding a default password to it.

    How would you handle this under such circumstances?

  • How to connect to Oracle Docker image
  • Running alembic in a python container that depends upon a mysql container
  • How could I read the first response of the http stream request
  • Docker connect to mocked service on host port
  • how to ignore logs with docker commit
  • Two-way authentication in Docker
  • One Solution collect form web for “Docker and SSH for development with phpStorm”

    I too have implemented the ssh server workaround when using jetbrains IDEs.

    Usually what I do is add a public ssh key to the ~/.ssh/authorized_keys file for the SSH user in the target container/system, and enable passwordless sudo.

    One solution that I’ve thought of, but not yet had the time to implement, would be to make some sort of SSH service that would be a gateway to a docker exec command. That would potentially allow at least some functionality without having to modify your images in any way for this dev requirement.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.