Search code examples
bashdockerescapingsingle-quotes

Triple-quoting for Docker bash entrypoint


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?


Solution

  • How about this?

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