Documentation Index
Fetch the complete documentation index at: https://mintlify.com/deuxfleurs-org/garage/llms.txt
Use this file to discover all available pages before exploring further.
Garage can be run in Docker containers, making it easy to deploy and manage across different environments. This guide covers both simple single-node setups and production multi-node deployments.
Docker Image
Garage’s official Docker image is hosted on Docker Hub as dxflrs/garage.
Always use a specific version tag (e.g., v2.2.0) rather than latest to ensure consistency and avoid unexpected updates.
Check the Docker Hub page for the most recent available versions.
Quick Start (Single Node)
For development or testing, you can quickly start a single-node Garage instance.
Pull the Docker image
docker pull dxflrs/garage:v2.2.0
Create a configuration file
Create a garage.toml configuration file in your current directory:cat > garage.toml <<EOF
metadata_dir = "/tmp/meta"
data_dir = "/tmp/data"
db_engine = "sqlite"
replication_factor = 1
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "127.0.0.1:3901"
rpc_secret = "$(openssl rand -hex 32)"
[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.localhost"
[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.garage.localhost"
index = "index.html"
[admin]
api_bind_addr = "[::]:3903"
admin_token = "$(openssl rand -base64 32)"
metrics_token = "$(openssl rand -base64 32)"
EOF
Set up credentials (optional)
Configure automatic bucket and key creation:export GARAGE_DEFAULT_ACCESS_KEY="GK$(openssl rand -hex 16)"
export GARAGE_DEFAULT_SECRET_KEY="$(openssl rand -hex 32)"
export GARAGE_DEFAULT_BUCKET="default-bucket"
Run the container
docker run \
-d \
--name garage-container \
-p 3900:3900 -p 3901:3901 -p 3902:3902 -p 3903:3903 \
-v $(pwd)/garage.toml:/etc/garage.toml \
-e GARAGE_DEFAULT_ACCESS_KEY \
-e GARAGE_DEFAULT_SECRET_KEY \
-e GARAGE_DEFAULT_BUCKET \
dxflrs/garage:v2.2.0 \
/garage server --single-node --default-bucket
This command does NOT create persistent volumes for data. If the container stops, all data will be lost. For persistent storage, see the production deployment section below.
On Linux, you can use --network host instead of port mappings for better performance:docker run -d --name garage-container --network host ...
Interacting with the Container
Use Docker exec to run Garage CLI commands inside the container:
# Check cluster status
docker exec garage-container /garage status
# Create an alias for convenience
alias garage="docker exec -ti garage-container /garage"
# Now you can use the alias
garage status
garage bucket list
Production Deployment
For production environments, you need persistent storage and proper configuration.
Directory Structure
Set up the following directories on your host:
sudo mkdir -p /etc/garage /var/lib/garage/meta /var/lib/garage/data
/etc/garage.toml - Configuration file
/var/lib/garage/meta/ - Metadata storage (use SSD if possible)
/var/lib/garage/data/ - Data storage (can be on HDD)
Production Configuration
Create a production configuration at /etc/garage.toml:
metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "lmdb"
metadata_auto_snapshot_interval = "6h"
replication_factor = 3
compression_level = 2
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "<this node's public IP>:3901"
rpc_secret = "<RPC secret>"
[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage"
[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.garage"
index = "index.html"
- Set
rpc_public_addr to the node’s public IP address for multi-node clusters
- Generate
rpc_secret with openssl rand -hex 32 and use the same value on all nodes
- Use
replication_factor = 3 for production (requires at least 3 nodes)
Running with Docker
docker run
docker-compose
docker run \
-d \
--name garaged \
--restart always \
--network host \
-v /etc/garage.toml:/etc/garage.toml \
-v /var/lib/garage/meta:/var/lib/garage/meta \
-v /var/lib/garage/data:/var/lib/garage/data \
dxflrs/garage:v2.2.0
Create a docker-compose.yml file:version: "3"
services:
garage:
image: dxflrs/garage:v2.2.0
network_mode: "host"
restart: unless-stopped
volumes:
- /etc/garage.toml:/etc/garage.toml
- /var/lib/garage/meta:/var/lib/garage/meta
- /var/lib/garage/data:/var/lib/garage/data
Start the service:
We use --network host because the network indirection added by Docker’s default bridge networking can prevent Garage nodes from communicating properly, especially with IPv6.
Docker Compose for Multi-Node Cluster
For a local multi-node setup, you can define multiple services:
version: "3"
services:
garage-node1:
image: dxflrs/garage:v2.2.0
restart: unless-stopped
volumes:
- ./node1/garage.toml:/etc/garage.toml
- ./node1/meta:/var/lib/garage/meta
- ./node1/data:/var/lib/garage/data
ports:
- "3900:3900"
- "3901:3901"
garage-node2:
image: dxflrs/garage:v2.2.0
restart: unless-stopped
volumes:
- ./node2/garage.toml:/etc/garage.toml
- ./node2/meta:/var/lib/garage/meta
- ./node2/data:/var/lib/garage/data
ports:
- "3910:3900"
- "3911:3901"
garage-node3:
image: dxflrs/garage:v2.2.0
restart: unless-stopped
volumes:
- ./node3/garage.toml:/etc/garage.toml
- ./node3/meta:/var/lib/garage/meta
- ./node3/data:/var/lib/garage/data
ports:
- "3920:3900"
- "3921:3901"
Environment Variables
Garage supports several environment variables for configuration:
| Variable | Description |
|---|
RUST_LOG | Set logging level: error, warn, info, debug, trace |
RUST_BACKTRACE | Enable backtrace on panic: 1 or full |
GARAGE_CONFIG_FILE | Path to configuration file (default: /etc/garage.toml) |
GARAGE_DEFAULT_ACCESS_KEY | Auto-create default access key |
GARAGE_DEFAULT_SECRET_KEY | Secret for default access key |
GARAGE_DEFAULT_BUCKET | Auto-create default bucket |
GARAGE_LOG_TO_SYSLOG | Enable syslog logging (requires syslog feature) |
GARAGE_LOG_TO_JOURNALD | Enable journald logging (requires journald feature) |
Setting Log Level
docker run -e RUST_LOG=garage=debug ... dxflrs/garage:v2.2.0
Advanced: Using Docker Registry with Garage
Garage can serve as a backend for Docker Registry:
Create bucket and key
garage bucket create docker-registry
garage key create docker-registry-key
garage bucket allow --read --write docker-registry --key docker-registry-key
Create registry configuration
Create registry-config.yml:version: 0.1
storage:
s3:
region: garage
regionendpoint: http://garage:3900
bucket: docker-registry
accesskey: <your-access-key>
secretkey: <your-secret-key>
Run Docker Registry
docker run -d \
-p 5000:5000 \
-v $(pwd)/registry-config.yml:/etc/docker/registry/config.yml \
--name registry \
registry:2
Troubleshooting
View Container Logs
docker logs garage-container
docker logs -f garage-container # Follow logs
Container Won’t Start
-
Check configuration file syntax:
docker run --rm -v $(pwd)/garage.toml:/etc/garage.toml \
dxflrs/garage:v2.2.0 /garage --version
-
Verify permissions on mounted directories
-
Check port conflicts:
sudo netstat -tlnp | grep -E ':(3900|3901|3902|3903)'
Networking Issues
- Use
--network host on Linux for better compatibility
- Ensure firewall rules allow traffic on ports 3900-3903
- For multi-node clusters, verify nodes can reach each other’s
rpc_public_addr
Next Steps
After deploying Garage with Docker:
- Configure your cluster layout
- Create buckets and access keys
- Set up a reverse proxy for HTTPS
- Configure monitoring
Alternative Installation Methods