Home
MinIO Containers
登录后可跨设备保存划线和私人笔记登录
MinIO Containers
Testcontainers can be used to automatically instantiate and manage MinIO containers.
Usage example
Create a MinIOContainer to use it in your tests:
Starting a MinIO container
MinIOContainer container = new MinIOContainer("minio/minio:RELEASE.2023-09-04T19-57-37Z");The MinIO Java client can be configured with the container as such:
Configuring a MinIO client
MinioClient minioClient = MinioClient
.builder()
.endpoint(container.getS3URL())
.credentials(container.getUserName(), container.getPassword())
.build();If needed the username and password can be overridden as such:
Overriding a MinIO container
MinIOContainer container = new MinIOContainer("minio/minio:RELEASE.2023-09-04T19-57-37Z")
.withUserName("testuser")
.withPassword("testpassword");Adding this module to your project dependencies
Add the following dependency to your pom.xml/build.gradle file:
GradleMaven
testImplementation "org.testcontainers:testcontainers-minio:2.0.5"<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-minio</artifactId>
<version>2.0.5</version>
<scope>test</scope>
</dependency>评论
登录后参与评论
正在加载评论…
KnowForge