Remote Python Debug to Docker Container over Ssh by using PyCharm

Furkan Pur
Jun 22, 2017 · 4 min read

Part 1: Docker Container Creation

$ docker info
$ docker pull ubuntu:16.04
# docker run –it –p 8022:22 ubuntu:16.04

Part 2: Ssh Server Configuration

$ apt update && apt install -y openssh-server
$ mkdir /var/run/sshd
$ echo 'root:testssh' | chpasswd
# Root password was changed with testssh
$ sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config$ sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd$ echo "export VISIBLE=now" >> /etc/profile
$ service ssh restart
$ docker port <your container name> 22
0.0.0.0:8022
$ ssh root@<your host ip> -p 8022

Part 3: PyCharm Deployment Configuration


Part 4: Remote Interpreter Configuration

Conclusion

References

Furkan Pur

Written by

Machine Learning Engineer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade