Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Yet Another Docker Image for Golang Development Environment

A docker image for developing program (application) in Golang. This image enables developers to develop program in Go without installing the language. To make things easier, this image also by default able to watch Go source files and build them when changes are detected. Additionally, vim with vim-go is also available for you who uses vim as the main code editor.

What's included?

Using the image

By default the images expose port 8080 to be linked to the host or other images. Your working directory should be mounted to the image's /go/src/app volume as it is the image's working directory. The main file of your program should be named with main.go to benefit the auto build upon changes, otherwise you should overide the default comand.

Watch and build Go files upon changes

$ docker run -v ${PWD}:/go/src/app -p "8080:8080" npatmaja/godev

Edit files using Vim

$ docker run -it -v ${PWD}:/go/src/app -p "8080:8080" npatmaja/godev vim

If you want to disable hardware control flow when using vim, i.e., enable CTRL-S and CTRL-Q, then you would want to use the following:

$ docker run -it -v ${PWD}:/go/src/app -p "8080:8080" npatmaja/godev sh -l
the-container-id:go/src/app# vim

sh -l tells sh to act as a login shell which then it will execute /etc/profiles and also every *.sh /etc/profile.d/ where the script to disable hardawaer control flow reside.

Handling permission issue

By default, Docker runs all commands with root user. This will create a permission issue when creating/editing your program's source code as the created/edited file will be owned by root user even after terminating the running container, which I found really annoying. To coupe with the issue, one of the solution is to specify a user when running the docker image using -u or --user:

 $ docker run -it -v ${PWD}:/go/src/app -p "8080:8080" -u `id -u`:`id -g` npatmaja/godev sh -l

The aforementioned command will pass the host's current user id and groud id as container's user. Hence, the resulting files owned by the same UID and GID.


Docker image for Golang development environment






No packages published