Created
April 1, 2020 03:48
-
-
Save guenp/594d3e7a91a4ef850942618c248735b3 to your computer and use it in GitHub Desktop.
Docker container with SSH for remote PyCharm interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build --build-arg DOCKER_SSH_PASS=<the_password> --force-rm -t <image_name> . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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