Shubham Upadhyay

Senior Backend Architect

Open to Collaborate
Bengaluru, IN
Connect Channels
DevOps Tooling 5 min read Feb 2024 ShubhamLabs

Building a Dockerfile & Docker Compose Generator

How a frustrating, repetitive setup habit turned into an instant, 100% client-side container boilerplate engine.

Shubham Upadhyay

Shubham Upadhyay

Senior Backend & Systems Engineer

01.

The Problem: Remembering Syntax You Already Understand

Whenever I kick off a new project, Docker is usually one of the very first things I reach for.

The real issue has never been understanding Docker. I understand images, containers, multi-stage builds, port mappings, networks, and persistent volumes.

The frustrating part is remembering all the small boilerplate details that go into writing configuration files from a completely blank screen.

Every single time you start, you have to mentally juggle a checklist: Which base image tag should I use? What is the default port for this framework? Do I need a custom build command? What packages are needed for PHP or Node? Does Redis or MySQL need a volume mount, and how should service networking look inside docker-compose.yml?

None of these questions is difficult on its own. But when starting from scratch, I kept catching myself opening three old repositories or searching Google for syntax I had already written dozens of times before. I knew what I wanted, but I didn't want to waste time typing the same boilerplate again.

"Understanding Docker concepts is not the same as wanting to reconstruct the same boilerplate syntax from memory every time you create a new repo."

— Shubham Upadhyay
02.

The Idea: Pick What You Need, Get the Files

I wanted to eliminate that friction completely. Instead of starting from an empty file or copying an old project and spending twenty minutes deleting everything I didn't need, what if I could just check off what my project actually uses and get clean configuration files instantly?

The Old Way (Bloated Templates)

  • Search online for a full-stack Docker boilerplate repository.
  • Clone a heavy repo packed with extra services and tools you have no intention of using.
  • Spend 15 to 20 minutes manually stripping out unused database drivers, volumes, and networks.
  • Risk subtle syntax typos, broken port bindings, or leftover environment variables that fail during docker compose up.

The Generator Way (Built on Demand)

  • Select your tech stack and exact runtime version (Node, PHP, Python, Go).
  • Choose your framework or project setup.
  • Specify your application port and an optional build command.
  • Check only the database or caching services you actually need (MySQL, PostgreSQL, Redis, MongoDB).
  • Get a clean, minimal Dockerfile and docker-compose.yml generated to match.
03.

How Your Choices Shape the Configuration

The generator works on a direct configuration matrix. Rather than filling out one generic master template, each option you pick in the interface dictates a specific piece of the container setup.

HOW SELECTIONS MAP TO CONTAINER ARTIFACTS
1 Language & Framework → Dockerfile Base Image & Package Manager
2 Container Port → EXPOSE Directive & Host Port Forwarding
3 Build Command → Build-stage Script & Execution Directives
4 Databases & Caches → Independent Compose Services & Volumes
5 Shared Network → Internal DNS Resolution Across Containers
04.

Why It Runs 100% Inside Your Browser

When building developer tools, the default reflex is often to build an API backend. But for this generator, having a server made zero sense. The tool doesn't build images or run containers—it simply turns your configuration choices into clean text files. Doing everything in the browser gave both the user and me huge wins:

Privacy & Speed for Developers

  • 100% Private: Your project architecture, internal ports, and database credentials never leave your browser tab.
  • Instant Feedback: Configuration updates happen in milliseconds with zero network latency or API roundtrips.
  • Works Offline: Once loaded, the generator continues to work smoothly even when disconnected from the internet.

Simplicity & $0 Cost for ShubhamLabs

  • No Backend Servers: Zero API routes to deploy, monitor, patch, or scale.
  • $0 Maintenance & Egress Bills: No recurring cloud compute costs to keep the utility running.
  • Zero Attack Surface: Without backend endpoints storing or parsing user inputs, there are no servers to secure or exploit.
  • Sustainable Engineering: Lightweight tools that run in the browser stay alive forever without maintenance overhead.
05.

Generating Usable Output (Not Commented-Out Clutter)

Generating text is easy. Generating clean configuration files that a developer can actually drop into a project and run without fixing syntax errors is what matters.

Many template tools dump one giant file with hundreds of commented-out lines, leaving you to clean up the mess. I took the opposite approach: the generator builds the configuration strictly around what you selected.

If you check Redis, a clean Redis service block with a health check, volume mapping, and environment configuration is added to docker-compose.yml. If you leave Redis unchecked, there is not a single line of Redis clutter in the output.

The tool outputs both files separately in dedicated preview panels: a tailored Dockerfile and a matching docker-compose.yml, ready to copy to clipboard or download with a single click.

docker-compose.yml
In-Memory Engine
# docker-compose.yml (Generated dynamically based on selected services)
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DB_HOST=postgres
      - REDIS_HOST=redis
    depends_on:
      - postgres
      - redis

  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: app_db
      POSTGRES_USER: root
      POSTGRES_PASSWORD: secret
    volumes:
      - pgdata:/var/lib/postgresql/data

  redis:
    image: redis:alpine
    restart: unless-stopped

volumes:
  pgdata:
06.

From Generator to Running Containers in 10 Seconds

The true test of any developer utility is how naturally it fits into a real workflow. Instead of getting stuck in configuration setup, the path from idea to working containers takes seconds:

The 3-Step Setup

  • Pick your stack, ports, and databases on the generator interface.
  • Click Download or Copy, and place Dockerfile and docker-compose.yml in your project root.
  • Open your terminal and run standard Docker commands.

Standard Commands, Zero Surprises

  • docker compose build — builds the image using the tailored multi-stage instructions.
  • docker compose up -d — starts your application and selected databases in detached mode.
  • All services communicate seamlessly via Docker's built-in bridge network using their service names.
07.

What This Project Taught Me

Automate Repetitive Friction

A useful developer tool doesn't need to solve a giant, complex problem. Eliminating small, repetitive setup tasks that developers do every week saves real mental energy and time.

Solve It in the Browser When You Can

If a problem can be solved in the client browser, never add a backend just for the sake of having one. It keeps tools faster, private, and free to host.

Modular Assembly Beats Giant Templates

Building configurations conditionally from granular blocks produces significantly cleaner output than handing someone a monster boilerplate file to prune.

Tools Should Support, Not Replace Understanding

The tool doesn't hide Docker concepts; it lets developers who already know what they need skip the tedious syntax lookup and jump straight to building.

Explore Further

Want to review the full ShubhamLabs overview?

Check out technical architecture, problems faced, and complete tech stack.

View Project Overview
Chat on WhatsApp
Navigating...