Last Updated: March 02, 2016
·
360
· miqui

Docker image creation tip

Docker treats the intermediate containers as a build cache. If, however, you do change an instruction in the Dockerfile or re-order some instructions around then Docker will only re-use the previously built containers up until the point where the Dockerfile has changed. So in your Dockerfile, make sure you perform all package installations and software compilations before you ADD folders. Otherwise, your builds will always take ages to complete.

3 Responses
Add your response

Hello my frind this is not a good tip you probally don't did much with docker at present

over 1 year ago ·

sorry, frank...while i welcome your feedback, this is what i have noticed while experimenting with image creation - my findings were also correlated from other users. this is why it is recommended to have a minimum amount of RUN commands in your docker file.

over 1 year ago ·

As a Docker noob, this would have saved me a big headache! Hope others see this before they make the same mistake as I did. In general, to all the most time consuming steps in your Dockerfile first. Little things like ENV variables can wait till later (in most cases)

over 1 year ago ·