Created
February 27, 2021 07:53
-
-
Save antonioiksi/1791fab1a8b49a48fe86cba893aaa8b5 to your computer and use it in GitHub Desktop.
Docker file with sshd predefined (user: user, pwd: password) For remote debug dockers
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
# CLion remote docker environment (How to build docker container, run and stop it) | |
# | |
# Build and run: | |
# docker build -t clion/debian-remote-cpp-env:9 -f Debian-remote-cpp-env.Dockerfile . | |
# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 --name clion_remote_env clion/debian-remote-cpp-env:9 | |
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222" | |
# | |
# stop: | |
# docker stop clion_remote_env | |
# | |
# ssh credentials (test user): | |
# user@password | |
# ssh user@localhost -p2222 | |
FROM debian:stretch | |
RUN apt-get update \ | |
&& apt-get install -y ssh \ | |
build-essential \ | |
gcc \ | |
g++ \ | |
gdb \ | |
clang \ | |
cmake \ | |
rsync \ | |
tar \ | |
python \ | |
&& apt-get clean | |
RUN ( \ | |
echo 'LogLevel DEBUG2'; \ | |
echo 'PermitRootLogin yes'; \ | |
echo 'PasswordAuthentication yes'; \ | |
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \ | |
) > /etc/ssh/sshd_config_test_clion \ | |
&& mkdir /run/sshd | |
RUN useradd -m user \ | |
&& yes password | passwd user | |
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment