• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A useful simple git container running in alpine linux, especially for tiny linux distro, such as RancherOS, which don't have package manager.

docker-git-alpine

If enjoy, please consider buying me a coffee.

A useful simple git container running in alpine Linux, especially for tiny Linux distro, such as RancherOS, which doesn't have a package manager.

DockerHub Badge

Additional notes about multi-arch images

This feature was added on 23th May 2021.

  1. Version v2.30.2 and 1.0.30 are manually pushed by me with multi-arch image supported
  2. Older version will be not updated as multi-arch images
  3. Newer vesions from now on will be multi-arch images (--platform linux/amd64,linux/arm/v7,linux/arm64/v8,linux/arm/v6,linux/ppc64le,linux/s390x)
  4. I don't support other architectures, except amd64, because I have no other environment to do that. If you have any issues with other arch, you need raise PR to fix it.
  5. There would be no difference for docker pull , docker run command with other arch, you can run it as normal. For example, if you need pull image from arm (such as new Mac M1 chip), you can run docker pull alpine/git:v2.30.2 to get the image directly.

Github Repo

https://github.com/alpine-docker/git

CI build logs

https://app.circleci.com/pipelines/github/alpine-docker/git

Docker image tags

https://hub.docker.com/r/alpine/git/tags/

Notes:

New tags with non-root user in image has been created.

alpine/git:<version>-user
alpine/git:user

Its uid and gid in container are 1000

$ docker run -ti --rm --entrypoint=id alpine/git:user
uid=1000(git-user) gid=1000(git-user)

Docker build from feature branch feature/non-root

Usage

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git <git_command>

For example, if you need clone this repository, you can run

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git clone https://github.com/alpine-docker/git.git

Optional usage 1:

To save your type, add this fuction to ~/.bashrc or ~/.profile

$ cat ~/.profile

...

function git () {
    (docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git "$@")
}

...

$ source ~/.profile

for example, if you need clone this repository, with the function you just set, you can run it as local command

git clone https://github.com/alpine-docker/git.git

Optional usage 2:

alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"

NOTES:

  • You need redefine (re-run) the alias, when you switch between different repositories
  • You need run above alias command only under git repository's root directory.

Optional usage 3:

alias git='docker run -ti --rm -u$(id -u):$(id -g) -e HOME=${HOME} -v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -v ${HOME}:${HOME} -v $(pwd):/git alpine/git'

NOTES:

  • set uid:gid and provide passwd and group from host
  • run git as the current user instead of root for proper ownership of files
  • can be used at any directory as evaluation of $(pwd) is defered until alias is used

Demo

$ cd application
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
$ git clone [email protected]:YOUR_ACCOUNT/YOUR_REPO.git
$ cd YOUR_REPO
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
# edit several files
$ git add . 
$ git status
$ git commit -m "test"
$ git push -u origin master

The Protocols

Supports git, http/https and ssh protocols.

Refer: Git on the Server - The Protocols

Automation builds

Set CI to run builds every month.

  • build latest alpine image locally
  • Get the git version from the image
  • use the git's version as image tag as well (v${GIT_VERSION})
  • update latest tag for this image

More Repositories

1

k8s

All-In-One Kubernetes tools (kubectl, helm, iam-authenticator, eksctl, etc)
Shell
194
star
2

socat

[Archived] Run socat command in alpine container - follow up project at https://github.com/alpine-docker/multi-arch-libs/tree/master/socat
Shell
105
star
3

helm

Auto-trigger docker build for kubernetes helm when new release is announced
Shell
80
star
4

terragrunt

Auto-trigger docker build for terragrunt when new terraform version released
Shell
35
star
5

multi-arch-docker-images

mutli-arch docker images, such as linux/arm/v7,linux/arm64/v8,linux/arm/v6,linux/amd64,linux/ppc64le,linux/s390x
Shell
16
star
6

httpie

[Archived] httpie running in docker alpine (python3+pip3+alpine+httpie). Follow up repo at https://github.com/alpine-docker/multi-arch-libs/tree/master/httpie
Shell
8
star
7

make

a simple container to run make command directly
Dockerfile
4
star
8

openssl

[Archived] run openssl in alpine image
Shell
3
star
9

doctl

DigitalOcean command line with kubernetes and helm
Shell
3
star
10

greengrass

AWS IoT Greengrass Docker Software
Shell
2
star
11

bundler

Auto-trigger docker build for bundler when new ruby release is announced
Shell
2
star
12

bundle-terraform-awspec

This is a special version to build a docker image to run awspec test for terraform projects.
Dockerfile
2
star
13

gcloud

(NOT READY) Auto-trigger docker build for gcloud (google cloud command line) when new release is announced
Dockerfile
2
star
14

flake8

[Archived] Auto-trigger docker build for fake8 , follow up project at https://github.com/alpine-docker/multi-arch-libs/tree/master/flake8
Shell
2
star
15

docker-with-buildx

Docker image with buildx preinstalled
Dockerfile
1
star
16

ansible

Shell
1
star
17

cfn

related cloudformation template tools, such as linter, convert, etc.
Dockerfile
1
star