JoulinRouge
JoulinRouge

Reputation: 466

minio client works from local but not from docker container

I have set up a minio server like so:

docker run -p 9000:9000 minio/minio server data &

the server works as I'm able to point my browser to http://172.17.0.2:9000 and login. If I use minio client from my console it is working too.

But I can't make it work from a docker container:

FROM fedora:latest

RUN mkdir /minio && \
    mkdir /minio/data

COPY ./script.sh /minio/script.sh

RUN \
    curl https://dl.min.io/client/mc/release/linux-amd64/mc > /usr/bin/mc && \
    chmod +x /usr/bin/mc

After that i run script.sh with a very simple docker-compose configuration and i have the following error:

sync_1  | + mc config host add local http://172.17.0.2:9000 minioadmin minioadmin --api S3v4 --lookup auto
sync_1  | Added `local` successfully.
sync_1  | ++ mc find local/test --newer-than 2d0h0m --ignore '*.html'
sync_1  | mc: <ERROR> Unable to stat `local/test`. Get http://172.17.0.2:9000/test/?location=: dial tcp 172.17.0.2:9000: i/o timeout.

(sync is the name of the service in the docker compose file and the command followed after the "+" are the results of running the script with bash -x option for debbugging).

What can be the reason? The server contains only small sample files.

Upvotes: 2

Views: 6733

Answers (1)

guesswho
guesswho

Reputation: 532

docker-compose uses container_name as address, don't use docker ips directly.

If you running it with docker-compose, your minio-mc command should look like this:

...
mc config host add local http://minio:9000 minioadmin minioadmin --api S3v4 --lookup auto

Upvotes: 2

Related Questions