Monthly Archives: December 2021

Docker – Setup git ssh server using docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM ubuntu:18.04
 
ENV TZ=Australia/Sydney
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
RUN apt-get update
RUN apt-get install -y bash git python3 g++ curl vim openssh-server sudo
 
 
RUN addgroup --gid 9999 git && adduser --uid 9999 --gid 9999 --shell /usr/bin/git-shell git
RUN addgroup --gid 9000 xxx && adduser --uid 9000 --gid 9000 --shell /bin/bash xxx
 
RUN echo git:password | chpasswd
RUN echo xxx:password | chpasswd
 
RUN mkdir -p /home/git
RUN mkdir -p /home/xxx
 
RUN chown -Rh git:git /home/git
 
COPY sshd_config /etc/ssh/sshd_config
 
EXPOSE 22
 
ENTRYPOINT service ssh restart && bash
 
CMD ["/bin/bash"]