Sign inSign up

wuliangxue/git

By wuliangxue

Updated about 6 years ago

A git simple client

Image
2

311

wuliangxue/git repository overview

Git Client Docker image

Quick reference

What is Git?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency..

avatar

How to use this image

Start a git client instance

Starting a git instance is simple:

$ docker run --rm --name git -v "$(pwd)":/git/repo wuliangxue/git:tag git clone https://github.com/docker-library/mysql.git

... where git is the name you want to assign to your container, tag is the tag specifying the docker image you want. See the list above for relevant tags.
git repository is stored in the VOLUME /git/repo, which can be used with --volumes-from some-volume-container or -v /home/git/repo:/git/repo (see docs.docker volumes).

Additionally, If you want to clone your private repository with SSH...

$ docker run -it --rm --name git -v "$(pwd)/.ssh/id_rsa":/root/.ssh/id_rsa -v "$(pwd)/.ssh/id_rsa.pub":/root/.ssh/id_rsa.pub wuliangxue/git:tag git clone [email protected]:docker-library/mysql.git

License

Do what the fuck you want to public license.

Dockerfile

ubuntu:18.04
#Dockerfile 
	
FROM ubuntu:18.04
MAINTAINER liangxue wu [email protected]
	
# add 清华源  https -> http
RUN echo 'deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse' > /etc/apt/sources.list \ 
	&& echo '#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse' >> /etc/apt/sources.list \
	&& echo 'deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list \
	&& echo '#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list \
	&& echo 'deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list \
	&& echo '#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list \
	&& echo 'deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list \ 
	&& echo '#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list \ 
	&& echo '#deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse' >> /etc/apt/sources.list \ 
	&& echo '#deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse' >> /etc/apt/sources.list
	
RUN apt-get update && apt-get install -y git
	
# init ssh
RUN mkdir ~/.ssh \
	&& touch ~/.ssh/id_rsa \
	&& chmod 600 ~/.ssh/id_rsa \
	&& touch ~/.ssh/id_rsa.pub \
	&& chmod 644 ~/.ssh/id_rsa.pub
	
VOLUME ["~/.ssh/id_rsa","~/.ssh/id_rsa.pub"]
	
# set git clone default dir
WORKDIR /git/repo
VOLUME ["/git/repo"]
alpine:3.12
# Dockerfile

FROM alpine:3.12
MAINTAINER liangxue wu [email protected]

# add 清华源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

# install git && ssh
RUN apk update && apk add git && apk add openssh

# init ssh
RUN mkdir ~/.ssh \
    && touch ~/.ssh/id_rsa \
    && chmod 600 ~/.ssh/id_rsa \
    && touch ~/.ssh/id_rsa.pub \
    && chmod 644 ~/.ssh/id_rsa.pub

#set timezone
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone \
    && apk del tzdata

VOLUME ["~/.ssh/id_rsa","~/.ssh/id_rsa.pub"]

# set git clone default dir
WORKDIR /git/repo
VOLUME ["/git/repo"]

Tag summary

Content type

Image

Digest

Size

14.8 MB

Last updated

about 6 years ago

docker pull wuliangxue/git:0.1-alpine