O'Reilly logo

Setting up your Go development docker environment by Liz Rice

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up your Go Development Docker Environment

In this lesson, you’ll learn how to set up a containerized development environment that rebuilds your Go code automatically as you edit your code.

If you put your Go code in containers, there are two build steps: compiling the code itself, and then building the executable (and any dependencies) into a container. In this lesson we see how you can use tools such as Realize to automatically rebuild your code, even within a container. We also look at how to generate a small and efficient container image for production distribution using Docker Multistage Builds.

This lesson is for you if you’re a Go programmer who is considering how to introduce Docker containers into your workflow—or you’re already bored of typing docker build.

Here are some things that you should have under your belt before going ahead with this lesson:

  • You should be comfortable with the command line

  • You should have a file editor that you like

  • You are happy compiling Go executables by using go build

Before we get started, make sure you:

Introduction and Motivations

Containers give you a really convenient way to package your code and ensure that you have the same dependencies and environment wherever you run it—whether it’s in production or on a teammate’s laptop. But during the development process, containers can seem like an extra, unnecessary step, especially for Go programmers. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required