參考:
Git-it:
https://github.com/jlord/git-it/blob/master/original-readme.md
Docker使用ssh:
https://docs.docker.com/engine/examples/running_ssh_service/
2016COSCUP工作坊
Step One
Dockerfile1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| FROM ubuntu:14.04 RUN apt-get update -qq RUN apt-get upgrade -y RUN apt-get install -y git nodejs npm vim nano RUN ln -s /usr/bin/nodejs /usr/bin/node RUN npm install -g git-it RUN apt-get install -y openssh-server RUN mkdir /var/run/sshd RUN echo 'root:password' | chpasswd RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
|
docker build -t my-git-it .
docker run -d -P --name yaya my-git-it
docker port yaya 22
會回傳可以ssh的port
ssh root@localhost -p xxxxx
git-it
Step Two
docker-compose.yml1 2 3 4 5 6
| version: '2' services: client: build: ./ ports: - "22"
|
docker-compose up -d
docker-compose scale client=3
docker-compose ps
強制登入後改密碼
在 Dockerfile 加上
RUN chage -d 0 root