#1
In modern cloud-native development, managing storage efficiently is a critical concern. Especially for Java developers working with Spring Boot, having a lightweight, local, and scalable storage solution during development is a huge advantage. One such solution is MinIO—an open-source, high-performance object storage system that is compatible with Amazon S3.
In this guide, we’ll walk you through how to install and run MinIO using Docker, which makes local development and testing more seamless. This article focuses solely on setting up the MinIO server; integration with Spring Boot will be addressed separately.

Why Use MinIO with Docker?

Using Docker to run MinIO provides several advantages:

  • Simplicity: One command is enough to start MinIO with Docker.
  • Portability: Easily spin up MinIO on any machine without OS-specific dependencies.
  • Isolation: Running MinIO in a container avoids polluting the host environment.
  • Speed: Docker makes it easy to start, stop, and remove MinIO instances for quick testing.

This makes Docker the ideal choice for setting up MinIO during Spring Boot development—especially when you want local object storage without relying on cloud infrastructure like AWS S3.

Prerequisites

Before installing MinIO with Docker, ensure the following are installed:

  • Docker: Install Docker Desktop for Windows or macOS, or Docker Engine on Linux.
  • Docker Compose (Optional): Useful if you want to extend your MinIO setup later.
  • Terminal or Command Line Interface: To run Docker commands.

You can verify Docker is working by running:

docker --version
sudo docker --version

Running MinIO with Docker

MinIO offers a prebuilt Docker image that can be pulled and run immediately.

Step 1: Create a Local Folder for MinIO Data

This folder will be mounted into the Docker container to persist files.

mkdir -p ~/minio/data

On Windows, you can use C:\minio\data instead.

Step 2: Run MinIO Docker Container

Run the following Docker command:

docker run -p 9000:9000 -p 9001:9001 \ --name minio \ -e "MINIO_ROOT_USER=minioadmin" \ -e "MINIO_ROOT_PASSWORD=minioadmin123" \ -v ~/minio/data:/data \ quay.io/minio/minio server /data --console-address ":9001"

Explanation:

  • -p 9000:9000: Exposes the MinIO API port.
  • -p 9001:9001: Exposes the MinIO Console UI.
  • --name minio: Names the container minio.
  • -e "MINIO_ROOT_USER=...": Sets the admin username.
  • -e "MINIO_ROOT_PASSWORD=...": Sets the admin password.
  • -v ~/minio/data:/data: Mounts the host data folder into the container.
  • quay.io/minio/minio: Official MinIO image.
  • server /data: Starts the MinIO server with /data as the storage directory.
  • --console-address ":9001": Enables access to the web console.

Step 3: Access the MinIO Web Console

Once the container is running, open your browser and go to:

http://localhost:9001
Log in using the credentials:

  • Username: minioadmin
  • Password: minioadmin123

You’ll be redirected to the MinIO Console where you can:

  • Create buckets
  • Upload files
  • Browse object metadata
  • Monitor server health

Step 4: Test MinIO API (Optional)

You can also test MinIO’s API using tools like cURL, Postman, or an S3-compatible SDK. For example, here’s how you might use mc (MinIO Client):
Download and install mc from https://min.io/download.
Configure it:

mc alias set localminio http://localhost:9000 minioadmin minioadmin123

Create a bucket:

mc mb localminio/springboot-bucket

Upload a file:

mc cp myfile.txt localminio/springboot-bucket

Managing MinIO Container
Here are some useful Docker commands for managing your MinIO container:
Stop MinIO:

docker stop minio

Start MinIO again:

docker start minio

Remove MinIO container:

docker rm -f minio

Note: Your data will remain intact as long as the local ~/minio/data directory is not deleted.

Docker Compose Option (Optional)

If you prefer to manage MinIO with Docker Compose, you can use the following docker-compose.yml file:

version: '3.7'
services:
  minio:
    image: quay.io/minio/minio
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin123
    volumes:
      - ./data:/data
    command: server /data --console-address ":9001"

Run it with:

docker-compose up -d

image quote pre code