Tl;dr: Don't use single quotes `'` in your Dockerfile instructions, but use double quotes `"`.
This is something interesting I discovered today by doing the following:
I ran `docker run --rm -it ruby` and I get the [official ruby image default CMD](https://github.com/docker-library/ruby/blob/9af33e632f173e90b4a7aba7644f2080b574e54f/2.5/stretch/Dockerfile#L77) command executed (which is an `irb` prompt).
Then I replaced the CMD command by the same command in this simple Dockerfile:
But this ended up with an error about `irb not found` (the exact output is this `/bin/sh: 1: [irb]: not found`).
I had never heard about single quote being erroneous...
But.. This was my fault not *RTFMing* enough...
It is indeed precised in the [Dockerfile reference](https://docs.docker.com/engine/reference/builder/#cmd) *(and also applicable to other commands like RUN, CMD, LABEL, ENV, ENTRYPOINT and VOLUME)*:
>**Note**: The *exec* form is parsed as a JSON array, which means that you must use double-quotes (“) around words not single-quotes (‘).
4 thoughts on “Be aware of the quotes in your Dockerfile”
Good to know. Thanks for sharing.
It’s just JSON, and JSON doesn’t use single quotes. When you’re working inside Dockerfiles, just “think JSON.”
Also, if you’re using Jenkins, don’t try to add more than one space after “FROM“ to align things.
Container builds will fail.
(The 100 lines of stack trace won’t point out a plug-in forgot to trim a string)