A minimal Docker setup to run the rustfs S3-compatible server alongside the rustfs-cli tool. This lets you quickly spin up a local object storage and manage buckets with a familiar, mc-style CLI.
- Runs a RustFS server exposing S3-compatible APIs on ports 9000/9001.
- Builds a lightweight container that installs the rustfs-cli binary and wires a convenient entrypoint.
- Preconfigures an alias named
localpointing to the RustFS server. - Supports batch bucket creation using
mb <bucket...>via the entrypoint.
Key files:
- docker-compose.yml
- Dockerfile
- Docker 24+
- Docker Compose (v2)
# Start RustFS and the CLI container (creates default buckets)
docker compose up -d
# See container logs
docker compose logs rustfs
docker compose logs rustfs-cliBy default, the CLI service starts with a command that creates a set of buckets commonly used by GitLab:
mb gitlab-artifacts gitlab-uploads gitlab-packages gitlab-lfs gitlab-backups \
gitlab-terraform gitlab-dependency-proxy gitlab-secure-files gitlab-pages \
gitlab-external-diffs gitlab-registry
You can edit that list in docker-compose.yml under the rustfs-cli service command: section.
The image provides the binary as rc (symlinked to rustfs-cli if needed). An alias named local is automatically created and points to the RustFS server.
Common operations:
# Show top-level help
docker compose run --rm rustfs-cli --help
# List buckets under the 'local' alias
docker compose run --rm rustfs-cli ls local
# Create a single bucket
docker compose run --rm rustfs-cli mb local/my-bucket
# Create multiple buckets in one shot via entrypoint short-hand:
# (the entrypoint expands 'mb' followed by names into alias-correct calls)
docker compose run --rm rustfs-cli mb my-bucket another-bucketIf you need to interact with local files, mount your working directory:
docker compose run --rm -v "$PWD:/work" rustfs-cli --helpEnvironment variables (can be set in compose or at runtime):
RUSTFS_ENDPOINT: RustFS server URL (defaulthttp://rustfs:9000)RUSTFS_ACCESS_KEY: Access key (defaultrustfsadmin)RUSTFS_SECRET_KEY: Secret key (defaultrustfsadmin)RUSTFS_ALIAS_NAME: Alias name created for the CLI (defaultlocal)RUSTFS_CLI_BINARY: CLI binary name (defaultrc)
See how these are consumed in the entrypoint in Dockerfile.
Ports and data:
- RustFS server ports:
9000(API) and9001(console) - Data volume:
./rustfs-data:/data(persisted locally)
The CLI used here is maintained at:
Highlights:
- S3-compatible client supporting RustFS, MinIO, AWS S3, and others
- Human-readable and JSON outputs, secure credential handling, cross-platform
Standalone installation options:
# Homebrew (macOS/Linux)
brew install rustfs/tap/rc
# Cargo
cargo install rustfs-cliThe entrypoint supports a convenient batch mode:
- If the first argument is
mband more names follow, it will create each bucket under the configured alias. - Otherwise, it will exec the CLI with provided arguments.
Reference: Dockerfile
The image builds the CLI using Cargo:
- Build arg
RUSTFS_CLI_CRATEcontrols which crate is installed (defaults torustfs-cli). - You can override it at build time:
docker build --build-arg RUSTFS_CLI_CRATE=rustfs-cli -t local/rustfs-cli .- Default credentials are for local development only; change
RUSTFS_ACCESS_KEYandRUSTFS_SECRET_KEYfor any non-local use. - Exposed ports are mapped to the host; avoid public exposure without proper hardening.
- Verify the alias exists:
docker compose run --rm rustfs-cli alias list- Check server health: open
http://localhost:9001if console is enabled. - Inspect logs with
docker compose logs.
MIT (or as per the upstream rustfs-cli license).