Home

Awesome

Dockramp

A Client-driven Docker Container Image Builder

truck-ramp

Features

Docker 1.8.0 will introduce a new API endpoint for copying files and directories into a container. With this addition, anyone can now implement their own build system using the Docker Remote API. Dockramp is the first proof of concept for an alternative to docker build.

Installation

Visit the release page to get a binary for the latest version on your OS/Arch. If you'd rather compile it yourself (like I would), you just need git and go:

project_dir="$HOME/dockramp/src/github.com/jlhawn/dockramp"
mkdir -p $project_dir
git clone https://github.com/jlhawn/dockramp.git $project_dir
GOPATH="$project_dir/Godeps/_workspace:$HOME/dockramp" go build -o /usr/local/bin/dockramp github.com/jlhawn/dockramp/cmd/dockramp

Usage

Invoking dockramp with no other arguments will use the current directory as the build context and use the file named "Dockerfile" in the current directory for build intstructions.

$ # Executes the Dockerfile in this repository.
$ dockramp 
Step 0: FROM golang:1.4.2
Step 1: MAINTAINER "Josh Hawn <jlhawn@docker.com> (github:jlhawn)"
Step 2: ENV PROJ_DIR /go/src/github.com/jlhawn/dockramp
Step 3: RUN sh -c "mkdir -p $PROJ_DIR"
 ---> 0744c1be2f5fb40c355bace595171c180f2a7b2d19ec15e0c92da2fa0c1d7198
Step 4: COPY . /go/src/github.com/jlhawn/dockramp
 ---> 8a40aa285e0ecc70ba5361085ef2faf0e755a8dbf7f2224b377c5c0035dc22a5
Step 5: RUN sh
Input:
	export GOPATH="$PROJ_DIR/Godeps/_workspace:$GOPATH"
	go build -o /usr/local/bin/dockramp github.com/jlhawn/dockramp/cmd/dockramp

 ---> 029e66e2587118f5f6c5176da65ffbde3b501b25136a637c3d700ee369104374
Successfully built 029e66e2587118f5f6c5176da65ffbde3b501b25136a637c3d700ee369104374

You can use the -C flag to specify a directory to use as the build context. You can also specify any Dockerfile with the -f flag (this file does not need to be within the context directory!).

dockramp also supports many of the standard options used by docker and uses many of the same environment variables and configuration files used by docker as well. Here is the full list of currently supported arguments:

$ dockramp --help
Usage of dockramp:
  --cacert="": Trust certs signed only by this CA
  --cert="": TLS client certificate
  --key="": TLS client key
  --tls=false: Use TLS client cert/key (implied by --tlsverify)
  --tlsverify=true: Use TLS and verify the remote server certificate
  -C=".": Build context directory
  -H="": Docker daemon socket/host to connect to
  -d=false: enable debug output
  -f="": Path to Dockerfile
  -t="": Repository name (and optionally a tag) for the image

Dockerfile Syntax

While the original Dockerfile parser used by docker build simply scans for complete (unescaped) lines and parses each instruction arbitrarily based on the command, the Dockerfile parser in Dockramp is a more traditional parser which processes tokens from the input Dockerfile into instructions of positional arguments.

The Dockerfile syntax used by Dockramp aims to be simple and familiar: a subset of unix shell syntax. Each instruction has a name, optional flag arguments, and positional arguments.

Tokens

Instructions

All instruction names are case insensitive, i.e, RUN and run are considered equivalent. However, all-caps is still the preferred form.

TODO