RUN

The RUN instruction is the central executing instruction for the Dockerfile. In essence, the RUN instruction will execute a command (or commands) in a new layer on top of the current image and then commit the results. The resulting committed image will be used as a base for the next instruction in the Dockerfile. As you will remember from Chapter 1, Introduction to Docker, layering is the core concept in Docker. RUN, takes a command as its argument and runs it to create the new layer.

This also means that COPY and ENTRYPOINT set parameters can be overridden at runtime, so if you don't change anything after starting your container, the result will always be the same. RUN however, will be executed at build time and no matter what you do ...

Get Docker and Kubernetes for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.