Public | Automated Build

Last pushed: 4 months ago
Short Description
Short description is empty for this repo.
Full Description


Specialized docker-hooked container
to keep git repositories checkouts up to date when BitBucket or Github
repositories are updated.


To create the image bbinet/hooked-git-workdir, execute the following
command in the docker-hooked-git-workdir folder:

docker build -t bbinet/hooked-git-workdir .

You can now push the new image to the public registry:

docker push bbinet/hooked-git-workdir


Then, when starting your hooked-git-workdir container, you will want to bind
port 80 from the hooked-git-workdir container to a host external port.

By default, hooked is configured to always trigger the command,
but this can by customized by providing your own hooked config in

If you want to checkout a private git repository, you can add your id_rsa
ssh private key in a volume and provide a custom git_ssh script like the

$ cat /config/git_ssh
/usr/bin/ssh -i /config/.ssh/id_rsa "$@"

Then, you will have to set the following environment variable, for git to use
you custom /config/.ssh/id_rsa ssh private key:

  • GIT_SSH=/config/git_ssh

The script will look for repositories to checkout in the
$GIT_REPO_PATH directory, and will checkout branches in $GIT_WORKDIR_PATH
These paths can be customized by setting the following environment variables:

  • GIT_REPO_PATH (defaults to /repositories)
  • GIT_WORKDIR_PATH (defaults to /workdir)

For example:

$ docker pull bbinet/hooked-git-workdir

$ docker run --name hooked-git-workdir \
    -v /home/hooked/data:/data \
    -e GIT_REPO_PATH=/data/my/repos \
    -e GIT_WORKDIR_PATH=/data/my/workdirs \
    -e GIT_SSH=/config/git_ssh \
    -p 80:80 \

Add git Repos

To add a git repo:

$ sudo -s
# cd /home/hooked/data
# mkdir repositories
# git clone
Cloning into 'my-repo'...
remote: Counting objects: 975, done.
remote: Compressing objects: 100% (542/542), done.
remote: Total 975 (delta 413), reused 975 (delta 413), pack-reused 0
Receiving objects: 100% (975/975), 750.18 KiB, done.
Resolving deltas: 100% (413/413), done.

Testing Web Hook

Use curl to hit the hook server:

$ curl -s localhost:8080/hooks/my-repo/master | python -mjson.tool
    "hooks": [
            "branch": null,
            "command": "/",
            "cwd": null,
            "name": "all",
            "repository": null,
            "stderr": "Note: checking out 'origin/master'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by performing another checkout.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -b with the checkout command again. Example:\n\n  git checkout -b new_branch_name\n\nHEAD is now at ca60959... Random commit message\nHEAD is now at ca60959... Random commit message\n",
            "stdout": "No local changes to save\n"
    "success": true
Docker Pull Command