Skip to main content

Deploy Rookout on a Go container

This short tutorial will walk you through the perfect Rookout deployment for containerized Go applications in four quick steps.

Get Your Application

First things first, choose an application. If you don't have one readily available, use our sample application.

Start by:

git clone
cd go-tutorial-2022

1. Add the GoSDK Package

Add The Rookout package:

go get -d

2. Start Rookout

Import and start the package to connect to your Rookout account (if you haven't signed up, do that here).

The best place to do that is at the beginning of your main function (in our case - main.go):

import (
// ...
rookout ""
// ...

func main() {
Token: "[Your Rookout Token]",
Labels: map[string]string{"env": "dev"},
// ...

Configuration is where you can get fancy. You have got additional options up your sleeve:

  1. Move options from environment variables to secret or configuration managers.
  2. If you are using a Rookout Controller, set up the remote host and port configuration.
  3. Dig deeper into other options available right here.

3. Build the Application

Make sure you have the CGO build dependencies:

apt update && apt install -y libffi-dev zlib1g-dev libedit-dev libc++-11-dev libc++abi-11-dev

Add the following flags to your build command:

go build -gcflags="all=-dwarflocationlists=true"

4. Embed Source Information

Rookout offers the smoothest debugging experience by fetching up-to-date source code for each server.

Set this up for containerized applications by adding a handful of files from your .git folder to the container image.

Edit (or add) your .dockerignore file and adapt the traditional .git exclude:

# Keep ignoring .git
# Allow specific files with !

Add a final COPY command to the Dockerfile.

COPY .git /.git

Note: in multi-stage builds like ours, make this change in the final stage.


One second! if you are not using our demo app, please commit and push your changes to a new branch.

Build and run your Docker image:

docker build . -t rookout-go-todo
docker run -it -p 8080:8080 rookout-go-todo

As your Go application spins up, search for this output at the top:

Interact with your application at http://localhost:8080 and use Rookout to debug it on the fly!


  1. Check out this reference implementation.
  2. Dig into the full Go SDK docs.
  3. Reach out to us via chat or email.