Skip to content

Instantly share code, notes, and snippets.

@OidaTiftla
Created May 9, 2022 19:59
Show Gist options
  • Save OidaTiftla/5de44d29e8f4e96f19ca1cf8fb1dc317 to your computer and use it in GitHub Desktop.
Save OidaTiftla/5de44d29e8f4e96f19ca1cf8fb1dc317 to your computer and use it in GitHub Desktop.
SSH within Docker-Container for testing purpose with git and bash-completion
version: '3.7'
services:
app:
container_name: docker-ssh
build: .
volumes:
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
ports:
- "22022:22"
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 "max.mustermann@example.com" && 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