I have this project which was initially set up on Mac, I’m on Windows, it’s a Docker project which runs Node, Kafka and a few other containers, one of them being MinIO. Everything works as intended except MinIO, I get the following error:
createbuckets_1 | /bin/sh: nc: command not found
Docker-compose code:
createbuckets:
image: minio/mc
networks:
- localnet
depends_on:
- minio
entrypoint: >
/bin/sh -c "
while ! nc -zv minio 9000; do echo 'Wait minio to startup...' && sleep 0.1; done; sleep 5;
/usr/bin/mc config host add myminio http://minio:9000 X X;
/usr/bin/mc rm -r --force myminio/cronify/details;
/usr/bin/mc mb myminio/cronify/details;
/usr/bin/mc policy set download myminio/cronify/details;
exit 0;"
Where X is, credentials are supposed to be.
I have been trying to find a fix for weeks.
I have also tried to change the entrypoint from /bin/sh -c
to /bin/bash -c
or #!/bin/bash -c
or #!/bin/sh -c
, I get the same error except ".../bin/bash: nc: command not found"
.
Dockerfile contains:
FROM confluentinc/cp-kafka-connect
2
Answers
I am not entirely sure what you are asking here, but if you are asking about the error message itself, it is telling you that
nc
is not installed (because it won’t be in a container). I am also not clear on which container minio is running in. Assuming the container is being pulled from minio/minio, then it will have curl installed, and you can just use the health check endpoint instead of trying to use nc – https://docs.min.io/minio/baremetal/monitoring/healthcheck-probe.html#minio-healthcheck-api. If it is not a minio container, you would just need to make sure it has curl installed (ornc
if for some reason you were set on using that).I’ve had a similar issue, but I am running minio on docker containers only (no docker-compose). However the code looks similar and I think this should work. You have to change only one line in your docker-compose file. This
nc -zv minio 9000
should be replaced withcurl -I http://minio:9000/minio/health/live
.Below is the entire snipped: