Created
May 9, 2022 19:59
-
-
Save OidaTiftla/5de44d29e8f4e96f19ca1cf8fb1dc317 to your computer and use it in GitHub Desktop.
SSH within Docker-Container for testing purpose with git and bash-completion
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
version: '3.7' | |
services: | |
app: | |
container_name: docker-ssh | |
build: . | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
restart: unless-stopped | |
ports: | |
- "22022:22" |
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
FROM ubuntu | |
RUN set Europe/Berlin timezone | |
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime | |
RUN apt update && apt install -y openssh-server git vim bash-completion | |
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN echo "root:Passw0rd" | chpasswd | |
ENTRYPOINT service ssh start && bash -c 'while true; do sleep 30; done;' | |
RUN git config --global init.defaultBranch main && git config --global user.email "[email protected]" && git config --global user.name "Max Mustermann" | |
RUN echo "source /etc/bash_completion" >> /root/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment