rkt Design Proposals

Getting Started with rkt

The following guide will show you how to build and run a self-contained Go app using rkt, the reference implementation of the App Container Specification.
If you're not on Linux, you should do all of this inside the rkt Vagrant.

Create a hello go application

packagemainimport("log""net/http")funcmain(){http.HandleFunc("/",func(whttp.ResponseWriter,r*http.Request){log.Printf("request from %v\n",r.RemoteAddr)w.Write([]byte("hello\n"))})log.Fatal(http.ListenAndServe(":5000",nil))}

Build a statically linked Go binary

Next we need to build our application.
We are going to statically link our app so we can ship an App Container Image with no external dependencies.

$ CGO_ENABLED=0 go build -ldflags '-extldflags "-static"'

Before proceeding, verify that the produced binary is statically linked: