gotchaMinor
What is the difference between RUN and CMD in a Dockerfile?
Viewed 0 times
thewhatdifferencedockerfilebetweenandcmdrun
Problem
I am going to change my permission of files to
But this one failed
In the beginning, I thought the shell environment isn't
600. The following command works perfectly.RUN /bin/bash -c 'chmod 600 /root/.ssh/config'But this one failed
CMD /bin/bash -c 'chmod 600 /root/.ssh/config'In the beginning, I thought the shell environment isn't
bash so caused the error. However, adding bin/bash didn't solve the issue.Solution
Note: Don’t confuse RUN with CMD. RUN actually runs a command and commits the result; CMD does not execute anything at build time, but specifies the intended command for the image.
reference
reference
Context
StackExchange DevOps Q#8298, answer score: 3
Revisions (0)
No revisions yet.