Docker Compose

This guide will help you set up pyroscope with Docker Compose.

Pyroscope consists of 2 parts:

  • Pyroscope Server — database + UI that stores and visualizes profiling data
  • Pyroscope Agent — software that profiles your application

Examples

Check out the examples folder in our repository for examples of go, ruby and python apps running in docker with pyroscope.

Adding Pyroscope to your docker-compose file

Step 1. Adding Pyroscope Server to Docker Compose

Add pyroscope service and expose port 4040:

---
services:
pyroscope:
image: "pyroscope/pyroscope:latest"
ports:
- "4040:4040"
command:
- "server"

Step 2. Adding Pyroscope Agent to your existing application

If you're using Go, add this code to your application:

package main
import "github.com/pyroscope-io/pyroscope/pkg/agent/profiler"
func main() {
profiler.Start(profiler.Config{
ApplicationName: "backend.purchases", # change this to your app name
ServerAddress: "http://pyroscope:4040",
})
// your code goes here
}