Member-only story

Containerizing Golang Applications — Learning Golang

Izzat Arramsyah
3 min readDec 23, 2020

--

image from google.com

INTRODUCTION

Before we start creating a Golang application container, it’s good to know what Docker is and the terms used in Docker. For more details, please click here.

PREREQUISITE

As an example project, please clone the GO application I have created.

https://github.com/izzatarramsyah/ProjectLogin-GOLANG

Please download and install Docker Desktop or use the Docker command. For simplicity, we will use Docker Desktop here.

CREATING DOCKER IMAGE

A Docker image contains everything needed for an application to run. To create a Docker image, we need to configure step by step how our application can run by creating a Dockerfile.

First, we need to initialize the GO application using Go Module. This feature makes it easy for us to initialize the application without having to pay attention to the GO PATH. Besides, it makes it easy for us if there are dependencies in the required application. So we don’t need to download them one by one.

Open the terminal, then go to the folder and run the following command.

go mod init github.com/izzatarramsyah/ProjectLogin-GOLANG

--

--

No responses yet