# jocker **Repository Path**: mirrors_nir0s/jocker ## Basic Information - **Project Name**: jocker - **Description**: Generate Dockerfiles from Jinja2 based templates and optionally build/push them - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2026-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README jocker ======= [![Build Status](https://travis-ci.org/nir0s/jocker.svg?branch=master)](https://travis-ci.org/nir0s/jocker) [![Gitter chat](https://badges.gitter.im/nir0s/jocker.png)](https://gitter.im/nir0s/jocker) [![PyPI](http://img.shields.io/pypi/dm/jocker.svg)](http://img.shields.io/pypi/dm/jocker.svg) [![PypI](http://img.shields.io/pypi/v/jocker.svg)](http://img.shields.io/pypi/v/jocker.svg) `jocker` generates [Dockerfiles](https://docs.docker.com/reference/builder/) from [Jinja2](http://jinja.pocoo.org/docs/dev/) based template files. You can optionally build an image from the generated file and even more optionally, push it to a hub. ### Requirements - must be run sudo-ically due to Docker's sudo requirement! - Python 2.6/2.7 - [Docker](https://www.docker.com/) ### Installation ```shell pip install jocker ``` ### Testing Disclaimer in broken english: This like 5 hours project. Tests yet, No. Hold as test being wroten. Yes. Well.. there are "some" tests.. but they don't test "build" and "push". ANyways... ### Usage ```shell jocker -h Script to run jokcer via command line Usage: jocker [--varsfile= --templatefile= --outputfile= --dockerconfig= --dryrun -v] [--build=|--push=] jocker --version Options: -h --help Show this screen. -f --varsfile= Path to varsfile (if omitted, will assume "vars.py") -t --templatefile= Path to Dockerfile template -o --outputfile= Path to output Dockerfile (if omitted, will assume "Dockerfile") -c --dockerconfig= Path to yaml file containing docker-py configuration -d --dryrun Whether to actually generate.. or just dryrun -b --build= Image Repository and Tag to build -p --push= Image Repository and Tag to push to (will target --build) -v --verbose a LOT of output (Note: should be used carefully..) --version Display current version of jocker and exit ``` ### Log location Jocker log files are generated at ~/.jocker/ ### Generating - A `varsfile` containing a dict named `VARS` should be supplied (if omitted, will default to vars.py). - A `templatefile` should Jinja2-ly correspond with the variables in the aforementioned `VARS` dict (if omitted, will default to Dockerfile.template) - An `outputfile` should be given (if omitted, will default to `Dockerfile`) ### Dryrun If Dryrun is specified, the output of the generated template will be printed. No file will be created. ### Build and Push Note that since, when building, Docker looks for a file named "Dockerfile", the output file must be "Dockerfile" if you want to be able to use the `-b` flag in conjunction with the generation of the Dockerfile from the template. You can let jocker know that after the Dockerfile was generated, you'd like to `Build` a Docker image and optionally Push it to your chosen repository. Note that for this to work you must be logged in to Docker Hub or your private images repo from your shell. Also note that for either of these features to work you MUST be sudo'd as it's a prerequisite of Docker. Also also note that you can't specify both --build and --push as --push triggers a build process anyway. #### docker-py configuration for `build` and `push` A `dockerconfig` yaml file can be specified which includes something like this: ```yaml client: base_url: 'unix://var/run/docker.sock' version: '1.14' timeout: 10 build: quiet: false nocache: false rm: false stream: false timeout: encoding: ``` This is the configuration for the docker client and for the build process as mentioned in https://github.com/docker/docker-py. If no file was specified, some defaults will be assumed. ### Vagrant The Vagrantfile supplied (which I haven't finished yet.. will let you know once it's ready) will loadz a vbox machine, install docker and jocker on it, generate a docker image from a template and run a container based on the image in a daemonized mode to demonstrate the KRAZIE RAW POWER of jocker (and docker.. I guess *wink*) ### Contributing Please do.