Skip to main content
Back to blog
tools 2 March 2020 1 min read

Docker Compose

Learn how to use Docker Compose to define and run multi-container Docker applications. This tutorial demonstrates setting up InfluxDB and Grafana containers with automatic startup.

M

Mark

Performance Testing Expert

Docker Compose is a tool for defining and running multi-container Docker applications. It leverages YAML configuration files to specify application services, allowing developers to launch all configured services with a single command.

Purpose

This tutorial demonstrates creating and operating both InfluxDB and Grafana containers simultaneously, with Grafana linked to InfluxDB and both configured for automatic startup.

Prerequisites

  • Linux OS (Debian demonstrated in this example)
  • Docker engine installed

Installation Steps

Install Docker Compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Make executable:

sudo chmod +x /usr/local/bin/docker-compose

Configuration File

Create a file called docker-compose.yml:

influxdb:
  image: influxdb
  container_name: influxdb
  ports:
    - "8086:8086"
    - "8083:8083"
    - "8090:8090"
  restart: unless-stopped
  volumes:
    - /srv/docker/influxdb/data:/var/lib/influxdb

grafana:
  image: grafana/grafana
  container_name: grafana
  ports:
    - "3000:3000"
  restart: unless-stopped
  user: "0"
  links:
    - influxdb
  volumes:
    - /srv/docker/grafana/data:/var/lib/grafana

Execution

Launch services as a daemon:

docker-compose up -d

This command will start both containers in the background. The restart: unless-stopped configuration ensures they will automatically restart after a system reboot.

Further Reading

Tags:

#docker #docker-compose #influxdb #grafana #containers #devops

The cheat sheets, as printable PDFs

All 52 are free to read on the site — no signup. Want them as A4 PDFs you can actually print? The pack covers JMeter, k6, Gatling, Docker, Kubernetes and observability, and costs nothing but an email address.

Get the PDF pack

Delivered by email. Unsubscribe any time — see our privacy policy.

Stuck on this in your own test suite?

I take on fixed-price, fixed-turnaround performance work — script migrations, HAR-to-script conversion and written performance audits. No calls required.

Get in Touch