Skip to main content

Build Status

Gitter chat

PyPI

PypI

jocker generates Dockerfiles from Jinja2 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 (errr… NO TESTS YET? what a n00b!)

  • Docker

Installation

pip install jocker

Testing

Disclaimer in broken english: This like 5 hours project. Tests yet, No. Hold as test being wroten. Yes.

Usage

jocker -h
Script to run jokcer via command line

Usage:
    jocker [--varsfile=<path> --templatefile=<path> --outputfile=<path> --dockerconfig=<path> --dryrun -v]
           [--build=<string>|--push=<string>]
    jocker --version

Options:
    -h --help                   Show this screen.
    -f --varsfile=<path>        Path to varsfile (if omitted, will assume "vars.py")
    -t --templatefile=<path>    Path to Dockerfile template
    -o --outputfile=<path>      Path to output Dockerfile (if omitted, will assume "Dockerfile")
    -c --dockerconfig=<path>    Path to yaml file containing docker-py configuration
    -d --dryrun                 Whether to actually generate.. or just dryrun
    -b --build=<string>         Image Repository and Tag to build
    -p --push=<string>          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

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

You can let jocker know that after the Dockerfile was generated, you’d like to either 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:

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.

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.

Release files for jocker 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jocker 0.0.5
File Size Uploaded
jocker-0.0.5.tar.gz 7.6 kB Details

Release files / jocker-0.0.5.tar.gz

Download URL jocker-0.0.5.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
121b0c24470c382f7beb22521da1fcd3533353a16cc4a2751bf1b5e36ceb5243
BLAKE2b-256 checksum
How to use checksums
ecfe1081e5a41b25713c61d2b21c9ae4641b7b6efd11c03a4ceaeb1ff8f50f86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page