Skip to main content
This guide demostrates how to use a PodArmor Go image to build a simple Go application.

Pull the PodArmor Go Image

Pull the PodArmor Go image using the following command, with the version you want to use:
docker pull parmor.azurecr.io/go/go:1.22

Create a Go application container

1

Create a Go application container

Create a new directory mkdir go-quickstart && cd go-quickstart and create a main.go file with the following content:
package main

import (
  "fmt"
  "math/rand"
)

func main() {
  randomNumber := rand.Intn(101)
  fmt.Printf("Hello, PodArmor! Random number: %d\n", randomNumber)
}
2

Create go.mod file

Create a go.mod file with the following content:
module podaror.org/go-quickstart

go 1.22
3

Create a Dockerfile

Create a Dockerfile with the following content:
FROM parmor.azurecr.io/go/go:1.22
COPY ./ /app/
WORKDIR /app
RUN go build -o go-random .
ENTRYPOINT ["./go-random"]
4

Build the Docker image

Build the Docker image using the following command:
docker build -t go-quickstart .
5

Run the Docker container

Run the Docker container using the following command:
docker run go-quickstart