Home > database >  Triple-quoting for Docker bash entrypoint
Triple-quoting for Docker bash entrypoint

Time:01-13

I have a Dockerfile with ENTRYPOINT ["/bin/bash", "--login", "-c"].

I am having trouble with triple-quoting.

None of the following commands to Docker work:

"echo 'New York\\\'s Finest'"
"echo 'New York\\'s Finest'"
"echo 'New York\'s Finest'"
'echo "New York\\\'s Finest"'
'echo "New York\\'s Finest"'
'echo "New York\'s Finest"'

Assuming that I need to quote the command, and there is a filename with a single quote in it that is an argument to the command, how do I resolve this?

CodePudding user response:

How about this?

"echo \"New York's Finest\""

CodePudding user response:

in general your issue is with the escaping in the bash command:

please see explenation at: How to escape single quotes within single quoted strings

and in the dockerfile you will need to get:

ENTRYPOINT ["/bin/bash", "--login", "-c", "'echo "new york'"'"'s finest "'"]

hope this reolve it for you.

  • Related