Image of Dockerfile vs Docker

I am working on creating some docker images that will be used for testing on dev machines. I plan to build it for our main application, as well as for each of our external dependencies (postgres, elasticsearch, etc.). For the main application, I am struggling with the decision to write a Dockerfile or compile an image to be hosted.

On the one hand, Dockerfile is easy to share and modify over time. On the other hand, I expect that the advanced configuration (configuring application properties files) will be much easier to do in vim before just writing a new image.

I understand that I can get the same result anyway, but I am looking for PROS, CONS and gotchas with any direction.

As a side note, I plan to wrap it all together using Fig . My initial impression of this tool was very positive.

Thanks!

+6
source share
2 answers

Using Docker File:

  • You have an audit trail that describes how an image is created. For me, this is fundamental if it will be used in the production line, where more people work, and service should be a priority.
  • You can automate the process of assembling your image, being an easy way to update the container using system updates or if it should participate in the continuous delivery pipeline.
  • This is a cleaner way to create layers for your container (each Dockerfile command is a different layer).

Modifying the container and making changes is great for testing purposes and for quick development for a conceptual test. But if you plan to use the result image for some time, I would definitely use Dockerfiles.

In addition, if you need to modify the file and do it using the bash tools (awk, sed ...), it is very tedious, you can add any file that you want externally during the build process.

+9
source

I completely agree with Javier, but you need to understand that a single image created using the docker file may be different from assembling an image with the same version of the docker file a day after.

perhaps during the build process you automatically get the latest application or os updates, etc.

And at this time, if you need to reproduce the crash or all that you cannot rely on the docker file.

+7
source

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


All Articles