How to dockerize Go application
When you develop an application then you need to dockerize your application.
Create an application, say
Hello world under
go mod init test
Dockerfile to dockerize application.
FROM golang:alpine AS builder
Build docker image following command.
docker build -t test:latest .
Run docker image following command.
docker run -it --rm test:latest
Then should print
Hello world on terminal.
The multiple stage is important in
Dockerfile. It can optimize size of docker image.