Object storage is a computer data storage that manages data as objects, as opposed to other storage architectures like file systems which manages data as a file hierarchy, and block storage which manages data as blocks within sectors and tracks.
Object storage is used for housing videos and photos, music, and files for online collaboration. In object storage, data is sectioned off into units (aka “objects”) where it is stored in a flat environment. Each object includes:
- Data
- Metadata
- Unique identifier
All data blocks for a file are contained together as an object and are stored in what is called a storage pool. To access data, the storage system uses a unique identifier and metadata to find the object. Data can be accessed using RESTful APIs, HTTP, and HTTPS.
Object storage is crucial to the functioning of cloud services and applications. And because of the way object storage works, you can scale very quickly, up to petabytes and exabytes (so long as the machine in question has the space).
MinIO is a high-performance object storage solution that provides an Amazon Web Services S3-compatible API and supports core S3 features. MinIO can run almost anywhere: public or private cloud, bare-metal infrastructure, orchestrated environments, and edge infrastructure.
In this guide, we will explore how to deploy a standalone MinIO server in Docker and Docker Compose.
Related content:
- How to set up Minio as an Object Storage in Rocky Linux Server
- How to set CORS headers on your Amazon S3 bucket
- How to store Django Static and Media files in Amazon S3
- Script to Upload files to AWS S3 Using Golang
- Using AWS S3 Programatically with Python using Boto3 SDK
- Using AWS S3 from the terminal with awscli
Prerequisites
Before proceeding, ensure that you have Docker installed. Please check out How to Install and Use Docker in Ubuntu 22.04 if you need help installing.
Tip: For local development, consider binding ports to
127.0.0.1so MinIO is not exposed on your LAN.
Start the container
Create a data directory:
| |
Pick credentials. For example:
| |
Run MinIO with Docker (standalone, single-node):
| |
The above commands work this way:
mkdircreates a new local directory at ~/minio/data in your home directory.docker runstarts the MinIO container.-pbinds a local port to a container port.--namecreates a name for the container.-vsets a file path as a persistent volume location for the container to use. When MinIO writes data to/data, that data mirrors to the local path~/minio/data, allowing it to persist between container restarts. You can replace~/minio/datawith another local file location to which the user has read, write, and delete access.-esetsMINIO_ROOT_USERandMINIO_ROOT_PASSWORD. These set the root credentials for the MinIO Console and API.
Ports and endpoints
- S3 API:
http://127.0.0.1:9000 - MinIO Console (UI):
http://127.0.0.1:9090
You can also check health endpoints:
| |
Running MinIO using Docker Compose
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
On modern Docker installations, Compose is available as a plugin via docker compose:
| |
Create a working directory:
| |
Create a docker-compose.yaml file:
| |
Start the container:
| |
To confirm that it is working as expected, check Compose processes:
| |
Connect your browser to the MinIO Server
Access the MinIO Console by opening:
http://127.0.0.1:9090
Port 9000 is used for the S3 API, while port 9090 is the Console/UI in this guide (because we set --console-address ":9090").
Log in to the Console with the credentials you defined in the MINIO_ROOT_USER and MINIO_ROOT_PASSWORD environment variables.
Install the MinIO Client
The MinIO Client (mc) allows you to work with your MinIO server from the command line (create buckets, upload/download, manage policies, etc).
Setting up in linux
Download the mc client and install it to a location on your system PATH such as /usr/local/bin. You can alternatively run the binary from the download location.
| |
Use mc alias set to create a new alias associated to your local deployment. You can run mc commands against this alias:
| |
Replace {MINIO_ROOT_USER} and {MINIO_ROOT_PASSWORD} with the credentials you defined for the container with the -e flags.
Create a bucket and upload a file:
| |
The mc alias set takes four arguments:
- The name of the alias
- The hostname or IP address and port of the MinIO server
- The Access Key for a MinIO user
- The Secret Key for a MinIO user
Conclusion
You can use the MinIO Console for general administration tasks like Identity and Access Management, Metrics and Log Monitoring, or Server Configuration. Each MinIO server includes its own embedded MinIO Console.