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.
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?
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.