In this scenario you will learn how to run your Golang development environment inside a Docker container. We'll also discuss how to build a Docker image suitable for Golang applications.
This was created based on http://blog.benhall.me.uk
As demonstrated in this scenario, Makefiles make it really easy to manage the creation of Docker images. By having a single file you can organise the required commands for creating, debugging and releasing in a single and consistent approach.
NAME = ocelotuproar/docker-warden
INSTANCE = docker-warden
.PHONY: default build copy debug run release dev push
default: build
build:
docker build -t $(NAME) .
copy:
docker create --name $(INSTANCE) $(NAME)
docker cp $(INSTANCE):/go/bin/app $(shell pwd)/build
docker rm $(INSTANCE)
debug:
docker run --rm -it --name $(INSTANCE) $(NAME) /bin/bash
run:
docker run --rm --name $(INSTANCE) $(NAME)
dev:
docker run -it --rm -w /go/src/github.com/$(NAME) -v $(shell pwd)/vendor/github.com/:/go/src/github.com/ -v $(shell pwd):/go/src/github.com/$(NAME) golang

Steps
Running Golang development environment inside Docker
Step 1 - Golang Dev as Container
docker run -it --rm \
--name=godev \
-w /go/src/ \
-v $(pwd):/go/src/ \
golang
You’ll love Katacoda

Guided Path
Knowing what you need to know is the hardest part. Our guided pathways help build your knowledge around real-world scenarios.

Learn By Doing
The best way to learn is by doing. All our tutorials are interactive with pre-configured live environments ready for you to use.

Stay up-to-date
It's a competitive industry. Your skills need to keep up with the latest approaches. Katacoda keeps your skills up-to-date.
You’ll love Katacoda

Guided Path
Knowing what you need to know is the hardest part. Our guided pathways help build your knowledge around real-world scenarios.

Learn By Doing
The best way to learn is by doing. All our tutorials are interactive with pre-configured live environments ready for you to use.

Stay up-to-date
It's a competitive industry. Your skills need to keep up with the latest approaches. Katacoda keeps your skills up-to-date.