1. 11
  1.  

  2. 2

    The “only one RUN block” thing really irks me, every time I see it recommended. Trying to minimize layers this way is an uphill battle, and if you are concerned about it you will be tempted to make bad decisions like omitting LABELs or ENVs etc that make your image much more useful at the expense of layers. Use multiple RUN commands; benefit from individual RUN command caching and more legible Dockerfiles; use a tool to squash your layers post-build. Consider using something like cekit as your image source instead of Dockerfiles.

    “Build your image FROM scratch” is bad advice (and a misleading heading, because the section talks about not doing this, but using multi-stage builds. Which is a good idea.)

    I particularly like the “Keep your images in two registries simultaneously” advice.

    1. 2

      “Build your image FROM scratch” is bad advice (and a misleading heading, because the section talks about not doing this, but using multi-stage builds. Which is a good idea.)

      May you elaborate on why using FROM scratch as the last stage is bad advice? I sincerely wouldn’t want something to be wrong in the post. Thanks!

      1. 2

        What you are actually suggesting in the article is fine advice, IMHO: but the heading “Build your image FROM scratch” is a little misleading because you aren’t building FROM scratch; your build phase is doing so from (in this case) Debian; which is fine.

        1. 2

          Oh, alright!

          I’ll try to change it up for something more precise. Thanks!

    2. 1

      Hey @ricardbejarano – just wanted to flag that your code portions are unreadable. It’s turning the background grey with a white text on top.

      1. 1

        Hey, thanks for pointing it out!

        I’m working on it.

        Edit: should be ok by now.