Skip to content

Instantly share code, notes, and snippets.

@guenp
Created April 1, 2020 03:48
Show Gist options
  • Save guenp/594d3e7a91a4ef850942618c248735b3 to your computer and use it in GitHub Desktop.
Save guenp/594d3e7a91a4ef850942618c248735b3 to your computer and use it in GitHub Desktop.
Docker container with SSH for remote PyCharm interpreter
docker build --build-arg DOCKER_SSH_PASS=<the_password> --force-rm -t <image_name> .
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
ARG DOCKER_SSH_PASS
RUN echo "root:${DOCKER_SSH_PASS}" | 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
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
#!/bin/bash
docker run -d --network <network_name> \
-v /home/guen/the_project/the_code:/the_code \
-v /home/guen/the_project/.pycharm_helpers:/root/.pycharm_helpers \
-p 2222:22 \
<image_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment