I am (desperately) trying to replicate this mlflow/ minio setup in podman: https://github.com/minio/blog-assets/blob/main/mlflow-minio-setup/docker-compose.yml. The tutorial runs fine in a VM using docker-compose.
In podman however, I simply cannot figure out how to execute the script to automatically create a bucket in minio. I tried many possible combination for the --entrypoint option, but it always fails with: Error: crun: executable file [/bin/sh,-c,/create_bucket.sh] not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
...
create_bucket.sh:
#!/bin/sh
sleep 5;
/usr/bin/mc config host add mlflow_minio_storage http://mlflow_minio_storage:9000 "$MINIO_ACCESS_KEY" "$MINIO_SECRET_ACCESS_KEY" --api S3v4;
/usr/bin/mc ls mlflow_minio_storage | grep -q challenge || /usr/bin/mc mb mlflow_minio_storage/mlflow;
/usr/bin/mc policy download mlflow_minio_storage/mlflow;
exit 0;
Dockerfile:
FROM docker.io/minio/mc
COPY create_bucket.sh /create_bucket.sh
RUN chmod +x /create_bucket.sh
podman run:
podman build -t minio_client:latest -f Containerfile
podman run \
--name=mlflow_minio_client \
--detach \
--secret=MINIO_ACCESS_KEY,type=env,target=MINIO_ACCESS_KEY \
--secret=MINIO_SECRET_ACCESS_KEY,type=env,target=MINIO_SECRET_ACCESS_KEY \
--net mlflow_net \
--network-alias mlflow_minio_client \
--restart always \
--requires mlflow_minio_storage \
--entrypoint ["/bin/sh","-c","/create_bucket.sh"] \
localhost/minio_client:latest
Even this simple case results in the same error. Am I misunderstanding something here?
podman run \
--entrypoint ["/bin/sh","-c","/usr/bin/mc version"] \
docker.io/minio/mc:latest
>>> Error: crun: executable file `[/bin/sh,-c,/usr/bin/mc version]` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
The Bourne shell has special handling for single and double quotes. The quotes around a double-quoted string will be removed, even if it's in the middle of a shell word. You can see this just running
$ echo x"HELLO"x
xHELLOx
Similarly, if you compare your command line and the error message, the double quotes are missing. These are removed by the shell before Podman sees them, so the argument is no longer a valid JSON array.
You should wrap that argument in single quotes, which prevents the shell from doing any further processing on the string
podman run \
...
--entrypoint '["/bin/sh","-c","/create_bucket.sh"]' \
...
Using a JSON array here is a Podman feature. In general resetting the container's entrypoint resets the command, and otherwise the entrypoint and command are concatenated together. The way you'd do this with docker run
should also work here: put the first word of the command as the --entrypoint
, and put the remaining words as independent shell words after the image name.
podman run \
...
--entrypoint /bin/sh \
localhost/minio_client:latest \
-c /create_bucket.sh
You don't need the sh -c
invocation just to run a simple command like this, and simpler still
podman run \
...
--entrypoint /create_bucket.sh \
localhost/minio_client:latest