How to Run Minio in Docker and Docker Compose

Step-by-step guide on how to run MinIO object storage in Docker and Docker Compose, persist data, and connect using the MinIO Console and `mc` client.

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:

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.1 so MinIO is not exposed on your LAN.

Start the container

Create a data directory:

1
mkdir -p ~/minio/data

Pick credentials. For example:

1
2
export MINIO_ROOT_USER="admin"
export MINIO_ROOT_PASSWORD="CHANGE_ME_TO_A_LONG_RANDOM_PASSWORD"

Run MinIO with Docker (standalone, single-node):

1
2
3
4
5
6
7
8
9
docker run \
  -d --restart unless-stopped \
  --name minio \
  -p 127.0.0.1:9000:9000 \
  -p 127.0.0.1:9090:9090 \
  -v ~/minio/data:/data \
  -e "MINIO_ROOT_USER=${MINIO_ROOT_USER}" \
  -e "MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}" \
  quay.io/minio/minio:latest server /data --console-address ":9090"

The above commands work this way:

  • mkdir creates a new local directory at ~/minio/data in your home directory.
  • docker run starts the MinIO container.
  • -p binds a local port to a container port.
  • --name creates a name for the container.
  • -v sets 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/data with another local file location to which the user has read, write, and delete access.
  • -e sets MINIO_ROOT_USER and MINIO_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:

1
2
curl -sS http://127.0.0.1:9000/minio/health/live
curl -sS http://127.0.0.1:9000/minio/health/ready

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:

1
docker compose version

Create a working directory:

1
2
3
4
mkdir ~/minio
cd ~/minio

mkdir -p data

Create a docker-compose.yaml file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
version: "3.9"
services:
  minio:
    image: quay.io/minio/minio:latest
    command: server /data --console-address ":9090"
    restart: always
    ports:
      - "127.0.0.1:9000:9000"
      - "127.0.0.1:9090:9090"
    volumes:
      - ./data:/data
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=CHANGE_ME_TO_A_LONG_RANDOM_PASSWORD
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:9000/minio/health/ready"]
      interval: 10s
      timeout: 5s
      retries: 5

Start the container:

1
2
3
4
5
docker compose up -d

[+] Running 2/2
 ✔ Network minio_minio_net  Created                0.1s
 ✔ Container minio-minio-1  Started

To confirm that it is working as expected, check Compose processes:

1
2
3
docker compose ps
NAME                IMAGE                 COMMAND                  SERVICE             CREATED             STATUS              PORTS
minio-minio-1       quay.io/minio/minio   "/usr/bin/docker-ent…"   minio               55 seconds ago      Up 53 seconds       127.0.0.1:9000->9000/tcp, 127.0.0.1:9090->9090/tcp

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.

1
2
3
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin/mc

Use mc alias set to create a new alias associated to your local deployment. You can run mc commands against this alias:

1
2
mc alias set local http://127.0.0.1:9000 {MINIO_ROOT_USER} {MINIO_ROOT_PASSWORD}
mc admin info local

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:

1
2
3
mc mb local/my-bucket
mc cp /etc/hosts local/my-bucket/hosts.txt
mc ls local/my-bucket

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.

Last updated on Jan 23, 2026 11:16 +0300
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy