Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of entrypoints #507

Closed
Engrammae opened this issue Jan 25, 2023 · 3 comments · Fixed by #515
Closed

Parsing of entrypoints #507

Engrammae opened this issue Jan 25, 2023 · 3 comments · Fixed by #515

Comments

@Engrammae
Copy link

Hey!
I would like to add ENTRYPOINT ["bash", "-c"] to my Dockerfile using the neurodocker option --entrypoint TUPLE. I tried adding it with and without quotation marks (--entrypoint bash -c. --entrypoint "bash" "-c" or --entrypoints 'bash' '-c') but I get the following error:

Usage: neurodocker generate docker [OPTIONS]                                                                            
Try 'neurodocker generate docker --help' for help.

Error: No such option: -c 

I guess the parameter -c is interpreted as an option of the generate docker command.

This can be reproduced by running the following script:

generate_docker() {
    docker run -i --rm repronim/neurodocker:0.9.4 generate docker \
        --base-image neurodebian:stretch-non-free \
        --arg DEBIAN_FRONTEND='noninteractive' \
        --pkg-manager apt \
        --entrypoint "bash" "-c"
}

generate_docker>Dockerfile.Test

If one could get this to work these lines could be a workaround for #506 :

RUN echo 'source activate csp' >> /home/csp/.bashrc`
ENTRYPOINT ["bash", "-c"]
@kaczmarj
Copy link
Collaborator

hi @Engrammae - thanks. the command line interface seems to be interpreting '-c' as a new option instead of a string literal value. for example this works --entrypoint bash c but this does not --entrypoint bash -c.

this is related to pallets/click#249 but i do not see an easy way to get around this. the linked issue mentions -- but i do not know where that would fit in with our command line.

@Engrammae
Copy link
Author

Hi @kaczmarj ,
thanks for your reply!
As far as I understand, the issue you linked adressess how to pass arguments that begin with a hyphen and tell click that this is an argument and not an option. In this case we would need to tell click that a parameter is an option value belonging to an option and that it's not another option.
While it is documented how to handle the setting described in the linked issue, I could not find anything in the documentation of click for our case.
If I am reading the code correctly, the option --entrypoint currently uses the option type Tuples as Multi Value. Could maybe the option type Multiple Values from Environment Values be of help? Maybe one could add another option --entrypoint-from-environment?

@djarecka
Copy link
Member

could we just modify slightly the value for entrypoint as suggested in #515?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants