Closed T4mmi closed 3 months ago
the https://github.com/minio/mc/issues/3599 resolution doesn't work here since the healthcheck
/depends_on:service_healthy
ensures that the instance is up&ready, AND i can do the creation manually.
It seems to me that the minio-client
container cannot communicate with the minio-server
one ... but I cannot find why
Ok, the problem came from the localhost mapping that wasn't consistent between the containers ... I missunderstood the extra_hosts
...
extra_hosts:
- "host.docker.internal:host-gateway"
is removed and replaced by
network_mode: service:s3
full docker-compose.yml
looks like:
services:
# run an S3 instance (minio)
s3:
image: minio/minio
container_name: minio-server
ports:
- ${S3_API_PORT}:${S3_API_PORT}
- ${S3_WEB_PORT}:${S3_WEB_PORT}
volumes:
- .minio/data:/data
- .minio/config:/root/.minio/
env_file: .env
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
MINIO_SERVER_URL: ${S3_ENDPOINT_URL}
MINIO_BROWSER_REDIRECT_URL: ${S3_WEB_URL}
command: server /data --address ":${S3_API_PORT}" --console-address ":${S3_WEB_PORT}"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 1s
restart: always
# create the bucket
mkdir:
image: minio/mc
container_name: minio-client
env_file: .env
depends_on:
s3:
condition: service_healthy
network_mode: service:s3
entrypoint: >
/bin/sh -c "
echo URL: ${S3_ENDPOINT_URL};
echo Credentials: ${S3_ACCESS_KEY}:${S3_SECRET_KEY};
/usr/bin/mc alias set s3 ${S3_ENDPOINT_URL} ${S3_ACCESS_KEY} ${S3_SECRET_KEY};
/usr/bin/mc mb s3/${S3_BUCKET_NAME} --ignore-existing;
/usr/bin/mc anonymous set public s3/${S3_BUCKET_NAME}
"
It sounds like your issue is resolved, closing.
Hi all, I'm trying to create a bucket inside a docker-compose service ... but I cannot manage to make it work !
Everything works if I do it "by hand", i.e.:
mc alias set s3 ${S3_ENDPOINT_URL} ${S3_ACCESS_KEY} ${S3_SECRET_KEY}
command locally after having the minio instance up and running) ...http://localhost/9001/buckets
)Steps to reproduce the behavior
docker-compose.yml
.env
System information
WSL-Ubuntu
5.15.153.1-microsoft-standard-WSL2
Dockerversion 24.0.7, build 24.0.7-0ubuntu2~22.04.1
docker-composeversion 1.29.2