How to Install and Use MinIO Object Storage with Docker – A Step-by-Step Guide
This article introduces MinIO, an open‑source object storage solution, explains its features and deployment options, and provides a detailed Docker‑based installation guide, including configuration, bucket creation, file upload, sharing links, and using the MinIO client for common operations.
MinIO Introduction
MinIO is an open‑source object storage service licensed under Apache License v2.0, suitable for storing large amounts of unstructured data such as images, videos, logs, backups, and container/VM images. Objects can range from a few KB to 5 TB. It is written in Go, provides a web UI, and can be deployed as an S3‑compatible storage cloud, offering a lightweight alternative to Hadoop HDFS and supporting single‑node deployment.
SDK (API): Official documentation lists SDKs for JavaScript, Java, Python, Go, and .NET.
Distributed deployment requirements:
All nodes must share the same access key and secret key, set as environment variables before running minio server.
Disks used by a distributed MinIO cluster must be empty.
Node time drift must not exceed 3 seconds.
At least four nodes are required; otherwise startup fails.
MinIO supports single‑node, multi‑tenant, and distributed deployments, with both raw file storage and erasure‑coded modes. In single‑node mode, the MinIO client can be used for backups.
Installing MinIO
Multiple installation methods exist; this guide uses Docker. Ensure Docker is installed.
2.1 Pull the MinIO image docker pull minio/minio 2.2 Verify the image docker images 2.3 Run the MinIO container
docker run -p 9090:9000 --name minio \
-v /etc/localtime:/etc/localtime \
-v /data/minio/data:/data \
-v /data/minio/config:/root/.minio \
-d minio/minio server /dataCheck running containers with docker ps, view logs with docker logs <container_id>, and monitor the container with docker stats <container_id>.
2.4 Access via browser
Open http://<em>host_ip</em>:9090/ and log in with the default AccessKey minioadmin and SecretKey minioadmin.
Create a bucket (e.g., test) using the “+” button, then upload files.
The bucket directory corresponds to /data/minio/data on the host. Files are stored as raw objects unless erasure coding is enabled.
Use the share button to generate a temporary URL (up to 7 days, minimum 1 minute). To obtain a permanent URL, edit the bucket’s policy to “read‑only” and ensure the prefix is set to “.”.
MinIO Client (mc)
The MinIO client provides UNIX‑like commands (ls, cat, cp, mirror, diff, find, etc.) for interacting with MinIO and other S3‑compatible services. Install it via Docker:
3.1 Pull the mc image docker pull minio/mc 3.2 Run the mc container
# Start an interactive shell
docker run -it --entrypoint=/bin/sh minio/mcConfigure a host with:
mc config host add minio http://172.20.32.232:9090 minioadmin minioadmin --api s3v4Common mc commands:
ls : list buckets or objects.
mb : create a bucket.
cat : display object content.
pipe : redirect STDIN to an object or file.
share : generate a shareable URL.
cp : copy files or objects.
mirror : mirror a bucket or folder.
find : search for files based on criteria.
diff : compare two buckets or folders.
rm : remove files or objects.
events : manage object notifications.
watch : monitor events.
policy : manage access policies.
session : manage saved sessions for cp.
config : manage mc configuration file.
update : check for updates.
version : display version information.
Examples:
mc ls minio # list buckets
mc ls minio/test # list objects in bucket test
mc mb minio/dnps # create bucket dnps
mc share download minio/test/small.jpg # generate download link
mc find minio/test --name "*.jpg" # find JPG files
mc policy set download minio/dnps/ # set bucket policy
mc cp minio/test/small.jpg minio/dnps/ # copy objectOriginal article: https://www.cnblogs.com/xiexun/p/15236703.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
