Using the official Go Docker image to try out a library

The official Docker language images can auto build and run your trial application a cinch. See how with golang:onbuild

We received a Pull Request to add Swagger support to document the Docker API, and @proppy asked if we could make sure we could load the schema in a standard json schema loader, for example gojsonschema

The answer is no, not yet – but we’ll work towards it 🙂

But to find out, I added 3 files, a Dockerfile:

FROM golang:onbuild

a Makefile:

docker build -t loadschema .
docker run --rm loadschema

and a tiny 13 line go program:

package main

import (

func main() {

_, err := gojsonschema.NewJsonSchemaDocument("file:///go/src/app/docker-v1.14.json")
if err != nil {

The golang:onbuild image has ONBUILD instructions to COPY the current context, download the dependencies, build the code, and then sets that application as the default CMD.