Skip to content

Instantly share code, notes, and snippets.

@mrryanjohnston
Created March 9, 2014 01:38
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrryanjohnston/9441704 to your computer and use it in GitHub Desktop.
Save mrryanjohnston/9441704 to your computer and use it in GitHub Desktop.
Golang development environment using Docker
FROM ubuntu:13.10
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang
RUN mkdir /go
RUN export GOPATH=/go
ENV GOPATH /go
RUN export PATH=$PATH:$GOPATH/bin
ENV PATH $PATH:$GOPATH/bin
WORKDIR /go
CMD go install hello && hello
// Taken directly from http://golang.org/
// /home/yourusername/go/src/hello/hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
# cd to the directory with the Dockerfile in it,
# then run
sudo docker build -t ubuntu-go .
# To run the container the first time, do
sudo docker run -v /home/yourusername/go:/go -name go ubuntu-go
# If you make changes to the hello package, just run
sudo docker start -a go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment