Followings are the steps to configure Python interpreter in a docker container in the deep learning server csdlsrv1
as the remote interpreter of a Pycharm Pro project.
- In
csdlsrv1
:
$ cd /DATA/username/
$ mkdir exp
$ cd exp
$ nano Dockerfile
FROM dl-image
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:1234567' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
ctrl+o
ctrl+x
$ nvidia-docker build -t expimage .
$ nvidia-docker run -d -P --name expcontainer expimage
$ nvidia-docker port test_sshd 22
0.0.0.0:32779
$ ssh root@localhost -p 32779
# The password is 1234567
root@f38c87f2a42d:/#
$ cd ..
$ chmod 777 root
- In
local
:
$ rm ~/.ssh/known_hosts
$ pkill ssh
$ ssh -f lvs.cs.bgu.ac.il -L 1234:csdlsrv1:32779 -N
$ ssh root@localhost -p 1234
$ scp -P 1234 myfile.py root@localhost:
root@0f224ae7bead:~#
- In Pycharm Pro (Free for students):
Create new project
Pure Python
Preferences
Project interpreter
Add interpreter
SSH interpreter
Host: localhost
Port: 1234
User: root
Password: 1234567