We value your privacy

This site uses cookies to improve your browsing experience, analyze site traffic, and show personalized content. See our Privacy Policy.

  1. MooseStack
  2. Configuration
  3. Docker Configuration

Docker Configuration

Configure how Moose generates and manages Dockerfiles for deployment packaging.

Configuration Source

Docker build settings can be configured in moose.config.toml for project-wide defaults, or overridden via environment variables (e.g., MOOSE_DOCKER_CONFIG__CUSTOM_DOCKERFILE=true) for specific environments.

moose.config.toml
[docker_config]# Use a custom Dockerfile instead of auto-generating one (Default: false)custom_dockerfile = false# Path to the Dockerfile relative to project root (Default: "./Dockerfile")dockerfile_path = "./Dockerfile"
KeyEnv VariableDefaultDescription
custom_dockerfileMOOSE_DOCKER_CONFIG__CUSTOM_DOCKERFILEfalseWhen true, Moose writes the Dockerfile to your project root (via moose generate dockerfile or on first moose build --docker) and preserves it on subsequent runs so you can customize it.
dockerfile_pathMOOSE_DOCKER_CONFIG__DOCKERFILE_PATH"./Dockerfile"Path to the Dockerfile relative to the project root. Only used when custom_dockerfile is true.

Behavior

By default, moose build --docker generates a Dockerfile internally (in .moose/packager/), builds the Docker image(s), and cleans up. To get an editable copy, enable custom_dockerfile and run moose generate dockerfile.

When custom_dockerfile = true:

  1. First run: Moose generates a Dockerfile at dockerfile_path — either via moose generate dockerfile or on the first moose build --docker.
  2. Subsequent runs: Moose detects the existing Dockerfile, skips generation to preserve your customizations, and builds from your Dockerfile.

This lets you iterate on the Dockerfile — add system dependencies, configure caching, adjust build stages — while still using moose build --docker to build images.

Related CLI Commands

To generate the Dockerfile without building a Docker image:

moose generate dockerfile
Requires Custom Dockerfile Mode

The generate dockerfile command requires custom_dockerfile = true in your moose.config.toml. If it's not enabled, the CLI will return an error with instructions on how to enable it.

To build Docker images:

# Build for both architectures (default)
moose build --docker
 
# Build for AMD64 only
moose build --docker --amd64
 
# Build for ARM64 only
moose build --docker --arm64

You can also enable custom Dockerfile mode during project initialization:

moose init my-app typescript --custom-dockerfile

On this page

BehaviorRelated CLI Commands
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source531
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Language Server
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
    • Core Settings
    • Project Settings
    • TypeScript
    • Telemetry
    • Git
    • Features
    • Migrations
    • Docker
    • Infrastructure
    • ClickHouse
    • Redpanda
    • Redis
    • Temporal
    • HTTP Server
    • State Storage
    • Security
    • JWT
    • Admin API
    • Development
    • Dev Environment
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework