Created
February 4, 2019 11:59
-
-
Save tom-code/53b9256e058797ac8685786d8102f5d0 to your computer and use it in GitHub Desktop.
kuber image as ssh server
This file contains hidden or 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
| Dockerfile: | |
| FROM alpine | |
| RUN apk --update add --no-cache openssh bash \ | |
| && sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \ | |
| && echo "root:root" | chpasswd \ | |
| && rm -rf /var/cache/apk/* | |
| RUN sed -ie 's/#Port 22/Port 22/g' /etc/ssh/sshd_config | |
| RUN sed -ri 's/#HostKey \/etc\/ssh\/ssh_host_key/HostKey \/etc\/ssh\/ssh_host_key/g' /etc/ssh/sshd_config | |
| RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config | |
| RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/ssh_host_dsa_key/g' /etc/ssh/sshd_config | |
| RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ecdsa_key/HostKey \/etc\/ssh\/ssh_host_ecdsa_key/g' /etc/ssh/sshd_config | |
| RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ed25519_key/HostKey \/etc\/ssh\/ssh_host_ed25519_key/g' /etc/ssh/sshd_config | |
| RUN /usr/bin/ssh-keygen -A | |
| RUN ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_key | |
| CMD ["/usr/sbin/sshd","-D"] | |
| --------------------------------------- | |
| docker build . -t minisshd | |
| kubectl run go --image=minisshd --restart=Never --image-pull-policy=Never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment