- Replies:
- 0
- Words:
- 6597

Using Docker to run MinIO provides several advantages:
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.
Before installing MinIO with Docker, ensure the following are installed:
You can verify Docker is working by running:
docker --version
sudo docker --version
MinIO offers a prebuilt Docker image that can be pulled and run immediately.
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.
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:
Once the container is running, open your browser and go to:
http://localhost:9001
Log in using the credentials:
You’ll be redirected to the MinIO Console where you can:
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.
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