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...
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 Answer
I've solved the problem by add "sleep" command to the enterypont
entrypoint: >
/bin/sh -c
sleep 10; # add this command
.......