I'm trying to understand how Dockerfile's RUN and CMD works.
From: https://docs.docker.com/engine/reference/builder/
The
RUN
instruction will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in theDockerfile
.The main purpose of a
CMD
is to provide defaults for an executing container.
And just to test if the RUN
and CMD
commands are executed from my Dockerfile
, I have
RUN touch "RUN.s.txt"
CMD touch "CMD.s.txt"
None of those command are executed, otherwise I'll see those two files created. So what went wrong?
docker build
anddocker run
? – John Kugelman