Go to file
Carlos Bernárdez 1acc99a94c Update README.md
Info about docker-compose
2016-09-10 03:36:05 +02:00
git-shell-commands Added restricted Git access with git-shell-commands 2016-07-28 12:05:26 +02:00
docker-compose.yml added docker-compose.yml 2016-09-10 03:27:12 +02:00
Dockerfile fix constraints issues about 'apk add' versions 2016-09-10 03:26:47 +02:00
README.md Update README.md 2016-09-10 03:36:05 +02:00
sshd_config Fixed ssh keys bug 2016-07-27 13:21:18 +02:00
start.sh Added comments 2016-07-28 02:35:04 +02:00

git-server-docker

A lightweight Git Server Docker image built with Alpine Linux. Available on GitHub and Docker Hub

Basic Usage

How to run the container in port 2222 with two volumes, keys volume for public keys and repos volume for git repositories:

$ docker run -d -p 2222:22 -v /home/jkarlos/git-server/keys:/git-server/keys -v /home/jkarlos/git-server/repos:/git-server/repos jkarlos/git-server-docker

How check that container works (you must to have a key):

$ ssh git@<ip-docker-server> -p 2222
...
Welcome to jkarlos/git-server-docker!
You've successfully authenticated, but I do not
provide interactive shell access.
...

How clone a repository:

$ git clone ssh://git@<ip-docker-server>:2222/git-server/repos/myrepo.git

Arguments

  • Expose ports: 22
  • Volumes:
  • /git-server/keys: Volume to store the users public keys
  • /git-server/repos: Volume to store the repositories

SSH Keys

How generate a pair keys in client machine:

$ ssh-keygen -t rsa

How upload quickly a public key to host volume:

$ scp ~/.ssh/id_rsa.pub user@host:/home/jkarlos/git-server/keys

Build Image

How to make the image:

$ docker build -t git-server-docker .

Docker-Compose

You can edit docker-compose.yml and run this container with docker-compose:

$ docker-compose up -d