sisko
sisko

Reputation: 9910

Docker-Compose minio switches port when viewed in browser

I am using the following section of my docker-compose.yml to add an s3 compatible service to my local development area:

  minio:
    image: minio/minio
    container_name: experiments_minio
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      - MINIO_ACCESS_KEY=12345678
      - MINIO_SECRET_KEY=password
    command: server /data

When I run docker-compose up, minio is present in the list on active containers:

bb3b62a7a094   quiz_experiments_www   "docker-php-entrypoi…"   4 hours ago   Up 4 hours   0.0.0.0:81->80/tcp                  experiments_www
121520becb01   minio/minio            "/usr/bin/docker-ent…"   4 hours ago   Up 4 hours   0.0.0.0:9000-9001->9000-9001/tcp    experiments_minio
94e7c9494226   adminer                "entrypoint.sh docke…"   4 hours ago   Up 4 hours   0.0.0.0:8080->8080/tcp              experiments_adminer
ef012349a6ce   mysql                  "docker-entrypoint.s…"   4 hours ago   Up 4 hours   33060/tcp, 0.0.0.0:3307->3306/tcp   experiments_db

My problem is when I visit localhost/9001, the browser switches the port portion of the url to some random numbers and I don't get the minio admin area.

The output from the commandline does mention using --console-address to set a static port or one will be assigned.

I can use the following code directly in the terminal to setup a minio container:

docker run \
  -p 9000:9000 \
  -p 9001:9001 \
  minio/minio server /data --console-address ":9001"

But how can the --console-address flag (or some equivalent) be set in docker-compose ?

Upvotes: 3

Views: 4901

Answers (1)

sisko
sisko

Reputation: 9910

This is the setup that worked after much research.

version: "3"

services:
  minio:
    image: minio/minio:latest
    container_name: experiments_minio
    # restart: always
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      - MINIO_ACCESS_KEY=12345678
      - MINIO_SECRET_KEY=password
      - CONSOLE_ACCESS_KEY=test
      - CONSOLE_SECRET_KEY=test
    command: server --address ":9000" --console-address ":9001" /data
    volumes:
      - minio_data:/data

volumes:
  minio_data:
    external: true

Upvotes: 17

Related Questions