Passing a command with arguments as a string to docker run
问题 The issue I'm facing is how to pass a command with arguments to docker run . The problem is that docker run does not take command plus arguments as a single string. They need to be provided as individual first-class arguments to docker run , such as: #!/bin/bash docker run --rm -it myImage bash -c "(cd build && make)" However consider the command and argument as the value of a variable: #!/bin/bash -x DOCKER_COMMAND='bash -c "(cd build && make)"' docker run --rm -it myImage "$DOCKER_COMMAND"