Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description


Minimal base image for hosting Django websites with Automatic Git Deployment functionalities including Webhooks

This image will pull your Django application code from a git repository with the goal to be displayed by a webserver (gunicorn). As soon as a new code is pushed to that repository, your Django application will be updated.

This image is based on "baseimage:0.9.19" which is very lightweight: it only consumes 6 MB of memory.

How to configure

This tutorial will explain how to setup this docker-django-git with a Github repository but it can work with other git platforms such as Bitbucket.

Preparing your SSH key

Let's generate a SSH key with ssh-keygen -t rsa. This will produce a public key and a private key. Do not set any password.

The public key will be used as is.
Open your Github repository, go to Settings, and then to Deploy keys. Add a new deploy key, set a title and copy/paste the public key.

The private key id_rsa will be converted to base64 by running base64 /path_to_your_key. This key will be used in the docker run command line.
Note: Copy the output be careful not to copy your prompt.

What your git repository should look like

At the root of your git repository, you should see the following :


Setup the webhooks

Open your Github repository, go to Settings, and then to Webhooks. Add a new webhook. Set the payload URL with<YOUR_GIT_HOOK_TOKEN>. The content type should be application/json.

You're ready to docker run!


You should now be able to access your django application with the following url :

Alternately, you can pull a repository and specify a branch add the GIT_BRANCH environment variable:


More configuration

Available Configuration Parameters

The following flags are a list of all the currently supported options that can be changed by passing in the variables to docker with the -e flag.

  • GIT_REPO : URL to the repository containing your source code
  • GIT_BRANCH : Select a specific branch (optional)
  • GIT_EMAIL : Set your email for code pushing (required for git to work)
  • GIT_NAME : Set your name for code pushing (required for git to work)
  • SSH_KEY : Private SSH deploy key for your repository base64 encoded (requires write permissions for pushing)
  • WEBROOT : Change the default webroot directory from /var/www/html to your own setting
  • TEMPLATE_NGINX_HTML : Enable by setting to 1 search and replace templating to happen on your code
  • DOMAIN : Set domain name for Lets Encrypt scripts
  • GIT_HOOK_TOKEN : Auth-Token used for the docker-hook listener
  • DJANGO_PROJECT_NAME : The name of your Django project


These links might help your if you want to learn about this docker image

Thanks to

This project is forked from eduwass/docker-nginx-git

Docker Pull Command