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.

  • What's a safe minimum disk size for a production Kubernetes node?
  • Docker Configuration´╝Üdocker.service vs daemon.json
  • How to create a Docker image of centos provisioned with apache?
  • How is docker able to mount a volume from docker client into a docker container running on docker host?
  • Adding portMappings to Dockerrun.aws.json with Single container configuartion
  • cant start docker after installation on linux
  • 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?

  • Can't deploy .war file using tomcat 6.0.24 and docker
  • Unable to run docker node.js application
  • Docker - Local Development on container
  • Docker Socket Without TLS
  • run /usr/sbin/sshd in a Dockerfile does not work
  • Error when building the blackbox_exporter Docker image
  • 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.