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

Parameters not properly processed in many dockerfiles #298

Open
jgriss opened this issue Dec 5, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@jgriss
Copy link
Contributor

commented Dec 5, 2018

This issue is found in several Dockerfiles (using the MSGFPlus one as example):

The "MSGFPlus" shell script is created using the following statement in the Dockerfile:

bash -c 'echo -e "#!/bin/bash\njava -jar /home/biodocker/bin/MSGFPlus_9949/MSGFPlus.jar $@" > /home/biodocker/bin/MSGFPlus' && \

In the actual container the $@ which passes on the command line parameters is missing. The solution to this is to escape the $@ by using single quotes and remove the bash -c command as it is not required anyways:

echo -e '#!/bin/bash\njava -jar /home/biodocker/bin/MSGFPlus_9949/MSGFPlus.jar $@' > /home/biodocker/bin/MSGFPlus && \

The exact same statement is used in several docker files, so it probably affects many images.

@osallou

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2018

@Raynooo can you have a look?

@Raynooo

This comment has been minimized.

Copy link
Collaborator

commented Dec 5, 2018

On it

@Raynooo

This comment has been minimized.

Copy link
Collaborator

commented Dec 5, 2018

I'm guessing the original recipe used bash -c to ensure echo -e was called correctly, without it the echo command prints -e #!/bin/bash on the first line. echo $ has the same problem and a simple echo won't cut it. Looking for a fix.

@Raynooo

This comment has been minimized.

Copy link
Collaborator

commented Dec 5, 2018

Simply escaping the $@ seems to work, the dockerfile line ends up being:
bash -c "echo -e '#!/bin/bash\njava -jar /home/biodocker/bin/MSGFPlus_9949/MSGFPlus.jar \$@' > /home/biodocker/bin/MSGFPlus" && \

@jgriss

This comment has been minimized.

Copy link
Contributor Author

commented Dec 6, 2018

Whether you use the single quote or escape the $@ has the same effect. If you use single quotes you don't have to escape any special characters which could be beneficial for more complex scripts.

@Raynooo

This comment has been minimized.

Copy link
Collaborator

commented Dec 6, 2018

As said in the previous message, somehow when using only echo -e '...' this is what's in the final image's msgfp bin:

-e #!/bin/bash
java -jar /home/biodocker/bin/MSGFPlus_9949/MSGFPlus.jar $@

Where the shebang is prefixed by -e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.