Wasasando

Be aware of the quotes in your Dockerfile

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:

FROM ruby
CMD ['irb']

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 (‘).

Exit mobile version