Cloud Computing 24 min read

Comprehensive Guide to Installing and Using MinIO with Spring Boot and Docker

This article provides a detailed tutorial on installing MinIO on CentOS 7 using Docker, configuring it, integrating with Spring Boot for multipart upload, generating presigned URLs, and includes complete Java code examples for utilities and controllers, covering use cases, deployment steps, and troubleshooting tips.

Top Architect
Top Architect
Top Architect
Comprehensive Guide to Installing and Using MinIO with Spring Boot and Docker

MinIO is an open‑source, high‑performance object storage server that supports simple deployment, scalability, high availability, security, and multiple storage modes such as object, block, and file.

Typical application scenarios include large‑scale data storage, media file handling, cloud‑native applications, disaster recovery, and big‑data or AI workloads that require fast, distributed access.

The article outlines the main steps for implementing multipart, instant, and resumable uploads with Spring Boot: front‑end file slicing, uploading each chunk to MinIO via its Java SDK, merging chunks on the back‑end, and handling errors.

Installation on CentOS 7 is performed with Docker. The required commands are shown below:

mkdir minio
docker search minio
docker pull minio/minio
docker run -p 9000:9000 -p 9090:9090 --net=host --name minio -d --restart=always -e "MINIO_ACCESS_KEY=IT@WangHui" -e "MINIO_SECRET_KEY=IT@WangHui" minio/minio server /data --console-address ":9000" -address ":9090"

After starting the container, firewall rules for ports 9000 and 9090 are configured using firewall-cmd to allow external access.

Spring Boot configuration files (application.yml) and a Java configuration class MinioConfig are provided to set the access key, secret key, URL, and bucket name.

spring:
  minio:
    access-key: dAMaxkWaXUD1CV1JHbqw
    secret-key: AXt3SD0JFkDENFbMeJKOOQb5wj8KvabZWu33Rs84
    url: http://192.168.18.14:9090
    bucket-name: wanghui
@Configuration
@ConfigurationProperties(prefix = "spring.minio")
public class MinioConfig {
    private String accessKey;
    private String secretKey;
    private String url;
    private String bucketName;
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
    }
}

A utility class MinioUtils implements bucket management, presigned policy generation, file upload, download, and URL retrieval methods, handling all necessary MinIO client interactions.

The REST controller MinioFileUploadController exposes endpoints for uploading files, downloading files, and obtaining file URLs, returning results wrapped in a custom AjaxResult structure.

Functional testing demonstrates large file uploads, generation of download URLs, and verification of the entire workflow, with screenshots illustrating each step.

JavadockerFile UploadSpringBootMinIOObject Storage
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.