Dealing with executable docker image

Hi all,

I think an issue I’m having stems from a docker container that is an executable I think (it appears to have a defined entry point). I can run docker just fine outside of nextflow with a command like the following:

docker run \
        --volume=/Users/senft/Documents/test_input:/input \
        --volume=/Users/senft/Documents/test_output:/output \
        cellprofiler/cellprofiler:4.2.6 \
        --image-directory /input \
        --output-directory /output \
        --pipeline /input/nucleoli.cppipe

But in nextflow, I error before I can so much as echo some text in my process where I use this container because of the entry point. What can I do to get around this? Is there a way to just pass in the flags or otherwise change the script to work with an executable container? I’m trying to use the nf-core style for making this module.

Thanks!

Hi @rebeccasenft

You can try to overwrite the entry point through the containerOptions process directive. Nextflow expects /bin/bash as entry point, so that’s what you should overwrite the entry point with. Check the example below:

process FOO {
  containerOptions '--entrypoint /bin/bash' 
  ...
}
1 Like

Thanks for the advice!

I’ve modified the process with containerOptions as you specified, but unfortunately I’m getting an error:

Command error:
  WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
  /bin/bash: /bin/bash: cannot execute binary file

(Ignore that first warning). When I search for /bin/bash: /bin/bash: cannot execute binary file I found this that suggests adding a “-s” flag bypasses the issue, but I can’t figure out how to do this with containerOptions. My attempt with "containerOptions “–entrypoint /bin/bash cellprofiler/cellprofiler:4.2.6 -s” did not work. Do you have any suggestions for things to try?

The -s in this link would be containerOptions '--entrypoint /bin/bash -s' in your case.

You should check if bash is installed in your container image. Every container image to be used with Nextflow should have a few tools installed such as bash, ps, among others (check here).

1 Like

Are you using a modern mac? There’s a whole world of fun with Docker on Apple Silicon, but adding this might force Docker to emulate x86:

docker.runOptions = '--platform=linux/amd64'
1 Like