skip to Main Content

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?

2

Answers


  1. How about this?

    "echo "New York's Finest""
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search