hands-on lab

Containerizing Go Applications with Docker: Advanced

Up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


In the previous lab, you created a simple command line utility and were able to containerize it with Docker. This lab will cover advanced topics of containerizing Go applications. In this lab, you'll containerize a simple web server application. This web server uses Go modules to handle dependencies and you'll learn how to manage them when building a Docker image. You'll also learn about the Docker multi-stage build pattern, and how to expose ports when running a Docker image.

Learning Objectives

Upon completion of this lab you will be able to:

  • Add third party libraries to Go source code using Go modules
  • Write a Dockerfile capable of managing third-party libraries in a Go application
  • Build the Docker image
  • Refactor the Dockerfile to use a multi-stage build architecture, and leverage Docker build caching

Intended Audience

This lab is intended for:

  • Developers, especially those working with Go
  • Anyone leveraging containers


You should possess:

  • Basic understanding of the Go programming language
  • Understanding of the Linux command line
  • Conceptual understanding of Docker

The following content is sufficient to fulfill these prerequisites:


August 17th, 2021 - Addressed an issue and clarified some instructions

About the author

Learning paths

Calculated Systems was founded by experts in Hadoop, Google Cloud and AWS. Calculated Systems enables code-free capture, mapping and transformation of data in the cloud based on Apache NiFi, an open source project originally developed within the NSA. Calculated Systems accelerates time to market for new innovations while maintaining data integrity.  With cloud automation tools, deep industry expertise, and experience productionalizing workloads development cycles are cut down to a fraction of their normal time. The ability to quickly develop large scale data ingestion and processing  decreases the risk companies face in long development cycles. Calculated Systems is one of the industry leaders in Big Data transformation and education of these complex technologies.

Covered topics

Lab steps

Connecting to the Go Development Environment
Working with Go Modules
Building and Testing the Greeter Server
Containerizing greeter-server with Docker
Refactoring Docker Builds