Error with Setting up minIO in Docker-Compose: Unable to Initialize New Alias from the Provided Credentials

I have trouble with setting up minIO in my docker-compose. I found this problem on several websites and tried to make it work. But I failed :D

Anyway, if anyone is able to help me I will call him my personal hero. Here is my code:

# docker-compose.yml

  minio:
    container_name: minio
    image: minio/minio
    ports:
      - "9000:9000"
    volumes:
      - ./minio-data:/data
    env_file:
      - app/.env
    command: server /minio-data

  mc:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "
      until (/usr/bin/mc config host add myminio  access-key secret-key) do echo '...waiting...' && sleep 1; done;
      /usr/bin/mc mb myminio/local-bucket/;
      /usr/bin/mc policy set download myminio/local-bucket;
      exit 0;
      "


# settings.py

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

AWS_ACCESS_KEY_ID = env.str("MINIO_ACCESS_KEY", default='access-key')
AWS_SECRET_ACCESS_KEY = env.str("MINIO_SECRET_KEY", default='secret-key')
AWS_STORAGE_BUCKET_NAME = env.str("AWS_STORAGE_BUCKET_NAME", default='local-bucket')

MINIO_STORAGE_USE_HTTPS = False

if DEBUG:
    AWS_S3_ENDPOINT_URL = env.str("AWS_S3_ENDPOINT_URL", default=')


# .env

MINIO_ACCESS_KEY=access-key
MINIO_SECRET_KEY=secret-key
AWS_STORAGE_BUCKET_NAME=local-bucket
AWS_S3_ENDPOINT_URL=

And thats my console logs:

1

1 Answer

I've solved the problem by add "sleep" command to the enterypont

 entrypoint: >
      /bin/sh -c 
      sleep 10; # add this command
      .......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest