What does # (nop) mean in docker history?

What does the #(nop) prefix mean when listing docker history ?

 $ docker history swarm IMAGE CREATED CREATED BY c54bba046158 9 days ago /bin/sh -c #(nop) CMD ["--help"] 
+6
source share
1 answer

NOP means no operation.

Docker launches a shell for each layer. All docker commands (or layers) in the Docker file, except for the RUN command, appear in the history as empty or commented out shell commands. The # sign marks the beginning of the comment, and all that will be skipped with /bin/sh after that. Similarly, if you type on the terminal:

 user@machine $ echo hello world hello world user@machine $ #But none of these lines starting with # do anything user@machine $ #echo hello world 

Non- RUN commands should not be interpreted by the shell, but are processed by the docker inside.

History (including non- RUN commands) can be used by the layer cache to skip processing if the same command was executed earlier.

+2
source

Source: https://habr.com/ru/post/1013460/


All Articles