A useful simple git container running in alpine linux.
201
A useful simple git container running in alpine Linux, especially for tiny Linux distro, such as RancherOS, which doesn't have a package manager.
docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git lucasbasquerotto/git <git_command>
For example, if you need clone this repository, you can run
docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git lucasbasquerotto/git clone https://github.com/lucasbasquerotto/docker-git.git
To save your type, create a git file in ~/bin/ with the following code:
#!/bin/sh
set -e
echo "git running inside docker at ~/bin/git"
docker run -it --rm -v ${HOME}:/root -v $(pwd):/git lucasbasquerotto/git "$@"
(Make sure that ~/bin is in your PATH)
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/lucasbasquerotto/docker-git.git
alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh lucasbasquerotto/git"
$ cd application
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh lucasbasquerotto/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 lucasbasquerotto/git"
# edit several files
$ git add .
$ git status
$ git commit -m "test"
$ git push -u origin master
Supports git, http/https and ssh protocols.
Content type
Image
Digest
Size
11.1 MB
Last updated
about 8 years ago
docker pull lucasbasquerotto/git