Free Web Developer Utility

Docker Compose Generator

High-performance Go & PostgreSQL Docker configurations. Pick your services, configure environments, and download your compose file.

Quick Start Guide

How to use the compiler tool in 3 simple steps:

1. Select Stack

Select Web Proxies, Backend Languages, and Databases in the selector grid.

2. Configure Properties

Adjust container labels, network ports, and custom environment variables in tabs.

3. Copy & Deploy

Instantly copy or download the generated `docker-compose.yml` to run in your terminal.

Quick Stacks:

Select Services

Enable the components needed in your container network. We'll automatically wire up database dependencies and port configurations.

Web Proxy

Languages & Frameworks

Databases & Caching

NODE_ENV
production
PORT
3000

Live Network Flow

Web
Client
NODE

docker-compose.yml

# =========================================================================
# Generated dynamically by HYVO Docker Compose Builder (hyvo.in)
# =========================================================================

services:
  node:
    image: node:20-alpine
    container_name: node-app
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000

About the Docker Compose Generator Tool

Compile and run Go backends alongside PostgreSQL. This configuration sets up a Go binary compilation environment next to a persistent PostgreSQL database instance, perfect for high-speed microservices. Our free online Docker Compose builder resolves the configuration hurdles developers face when setting up multi-container networks locally. Manually writing YAML can lead to spelling errors, indentation crashes, and network connection issues. This tool automates the creation of a clean `docker-compose.yml` file, matching exposed host ports, linking dependencies via `depends_on`, setting restart limits, and configuring persistent named volumes for databases.

Production Multi-Stage Dockerfiles for Go Applications

Static Binary Compilation

Compile Go with CGO_ENABLED=0 GOOS=linux. This generates a statically linked, self-sufficient binary containing all system libraries, meaning it can execute inside a completely empty Docker runtime.

Building to Scratch Containers

Reduce your container image size from 800MB down to 15MB. Stage 1 compiles the Go binary using golang:alpine. Stage 2 copies the binary into a scratch or alpine runtime, reducing host storage overhead.

Production DockerfileOptimized
# Stage 1: Build Binary
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o main .

# Stage 2: Lightweight Runner
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/main .
EXPOSE 8080
CMD ["./main"]

What is Containerization?

Containerization is a lightweight form of virtualization that packages an application's code, dependencies, libraries, and configurations into a single executable package called a container. Unlike virtual machines (VMs) that require a full guest operating system, containers share the host OS kernel, making them incredibly fast to boot, memory-efficient, and portable across developer laptops, staging servers, and cloud clusters.

What is Docker?

Docker is the industry-standard software platform used to build, share, and run containerized applications. By utilizing a Dockerfile, you specify the exact steps to compile your app. Docker packages these instructions into a immutable "Docker Image." When you run that image, it becomes a "Docker Container." This ensures your application behaves exactly the same in local development as it does in production, eliminating the classic "works on my machine" problem.

What is Docker Compose?

If your application relies on more than one container (e.g., a frontend app, a backend API, a PostgreSQL database, and a Redis cache), running them manually using single `docker run` commands is tedious. You have to manually set up virtual networks, link ports, manage container dependencies, and map storage paths.

**Docker Compose** solves this by letting you define your entire multi-container application stack in a single YAML file (`docker-compose.yml`). With a simple command—`docker compose up`—Docker automatically spins up all the services, builds the virtual bridge networks, mounts storage volumes, and starts log streams.

Understanding Docker Compose settings

Exposed Ports

Mapped as `host:container` (e.g. `3000:3000`). The first port exposes the service to your host machine (localhost), while the second port is the internal port the app listens to inside the container.

Persistent Volumes

Named volumes (e.g. `postgres_data`) map directory paths inside the database container to the host storage. This ensures your database records, users, and tables are saved when you stop your container.

Service Networks

Docker Compose automatically sets up a shared bridge network. All services in the same file can reach each other using their container name (e.g., connection host becomes `postgres-db`).

How to Use the Generated File

1

Save the File

Download the file and save it exactly as `docker-compose.yml` in the root folder of your project.

2

Verify Docker Installation

Ensure you have Docker Desktop (Windows/macOS) or Docker Engine (Linux) installed and running on your machine.

3

Start your containers

Open your terminal in the directory of your file and run: `docker compose up` or `docker compose up -d` (to run in the background).

Frequently Asked Questions

How do I trigger hot-reload for Go inside Docker?

You can mount your local workspace into the Go container and run tools like 'Air' (cosmtrek/air) inside the container to auto-compile on changes.

What Go docker images should I use?

Use 'golang:alpine' for a complete dev build. For production, multi-stage build the binary and copy it to a tiny 'scratch' or 'alpine' image.

What is a dynamic Docker network?

Docker Compose sets up a single network for your application by default. Each container joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name.

How do I verify container status?

Use the command `docker compose ps` to inspect running containers, mapped ports, and health statuses, or view them inside the graphical interface of Docker Desktop.

Build and scale with HYVO

Don't spend hours debugging Docker network links. Use this generator to wire your stack, and let our senior engineering collective build out your product.