---
title: "GoFiber v3 + Testcontainers: Production-like Local Dev with Air"
description: "Fiber v3's new Services API lets a Go web app start and stop backing dependencies as part of its own lifecycle, and a Testcontainers contrib module plugs real Docker containers into it."
url: "https://swe.quest/articles/gofiber-v3-testcontainers-production-like-local-dev-with-air-d8c159a9b0421bda"
canonical: "https://www.docker.com/blog/go-local-dev-fiber-v3-testcontainers/"
source: "Docker"
published: "2025-07-17"
difficulty: "medium"
kind: "How-to"
reading_minutes: 15
tags: ["go","testing","developer-productivity","containers","postgres"]
---

# GoFiber v3 + Testcontainers: Production-like Local Dev with Air

A post on [Docker](https://swe.quest/sources/docker.md), published 2025-07-17, 15 min read, How-to. Original: [https://www.docker.com/blog/go-local-dev-fiber-v3-testcontainers/](https://www.docker.com/blog/go-local-dev-fiber-v3-testcontainers/)

## Summary

Fiber v3's new Services API lets a Go web app start and stop backing dependencies as part of its own lifecycle, and a Testcontainers contrib module plugs real Docker containers into it. A todo app walkthrough uses Go build tags to keep a production config that reads the database URL from the environment, alongside a dev config that launches PostgreSQL 16 via testcontainers-go and reads the connection string from app state. It also sets startup and shutdown context providers with timeouts, and uses air for hot reload. Disabling Ryuk and reusing containers by name keeps the database alive across reloads for a fast inner loop.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Go](https://swe.quest/tags/go.md) (Languages)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [Developer productivity](https://swe.quest/tags/developer-productivity.md) (Engineering practices)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- Go basics ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- Docker containers ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- Go build tags ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))

## Keywords

Fiber v3, Testcontainers, testcontainers-go, Air, PostgreSQL, Ryuk, GORM

## Related posts

- [Functional tests with Testcontainers](https://swe.quest/articles/functional-tests-with-testcontainers-8e8bddfb01d0b1bc.md): Zalando Engineering · 2022-04-11 · Medium · 7 min read · Testing, Java & JVM, Containers
  Black-box functional tests for a Spring service can run against the service packaged as a Docker image, with PostgreSQL and other dependencies started as separate containers via Testcontainers.
- [Using modules for Testcontainers with Golang](https://swe.quest/articles/using-modules-for-testcontainers-with-golang-07887e1f0f647794.md): Zalando Engineering · 2023-12-18 · Medium · 4 min read · Testing, Go, Containers
  Testcontainers for Go lets integration tests start real dependencies such as Redis in containers, but raw usage requires knowing ports, wait strategies and environment details.
- [Shift-Left Testing with Testcontainers: Catching Bugs Early with Local Integration Tests](https://swe.quest/articles/shift-left-testing-with-testcontainers-catching-bugs-early-with-local-f90241b596ffcd90.md): Docker · 2025-03-13 · Medium · 10 min read · Testing, Developer productivity, PostgreSQL, TypeScript
  Running integration tests locally against real dependencies via Testcontainers catches bugs that unit tests and mocks miss, before code reaches shared CI or staging environments.
- [Leveraging Testcontainers for Complex Integration Testing in Mattermost Plugins](https://swe.quest/articles/leveraging-testcontainers-for-complex-integration-testing-in-mattermost-plugins-3edaea4757026529.md): Docker · 2024-10-08 · Medium · 6 min read · Testing, Containers, Go, JavaScript
  Mattermost replaced brittle mock-based plugin tests with Testcontainers-driven integration tests that spin up a Mattermost server, PostgreSQL on an internal Docker network, and optional API mock containers.
- [Beyond Docker Compose: An Alternative for Deploying Postgres for Testing](https://swe.quest/articles/beyond-docker-compose-an-alternative-for-deploying-postgres-for-testing-119ea8d590b0c90d.md): Neon · 2025-02-24 · Medium · 8 min read · PostgreSQL, Testing, Containers, CI/CD
  Docker Compose with the official Postgres image gives each developer and CI run an isolated test database, but it struggles with production-like seed data, leftover state between runs, and RAM/CPU overhead.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
