I've been thinking about how many different services often need the same runtime environment. The only thing that usually changes is the executables each service uses. When these executables are compiled, they could be uploaded to what's essentially an "exe registry". This way, a container can just download the specific executable and run it. I'm curious if this approach could help save resources and time when building images. What are your thoughts on packing executables into images instead of downloading them at runtime?
4 Answers
Absolutely! The primary purpose of images is to be immutable after they are built. If your services share a base environment, create a base image and have all your other images build off of that. This way, when a new executable is needed, you only update that layer instead of the whole image. It's definitely more efficient that way!
That makes a lot of sense! But I've found that when changes occur, I still face delays because I have to build and deploy a new image every time. Any advice on speeding that process up?
The layers in container images are key here! Use a base image for all common components, and then each executable can sit in its own layer. This way, all your images share these base layers, significantly reducing pull time and making your builds more efficient. Just be smart about your Dockerfiles!
But does that mean I would also have to send the full image to worker nodes every time changes occur?
It's true that worker nodes shouldn't have to pull the entire image repeatedly, which is an issue. Ideally, only the new layers should be dispatched. Still, I'm not sure how practical that is for my setup.
We compile and use a scratch image for our production deployments. For dev and non-prod, we maintain a golden image tailored for troubleshooting and diagnostics. It's a good balance of having essential tools without going overboard.
For sure, the point of using images is having everything baked in. Basing your applications on a solid base image and configuring with environment variables is the way to go. Plus, think about it: reusing base images keeps your image pulls fast and efficient by only adding the unique executable layers on top!
Totally agree! And it means your setup can scale better too, right?
Right, but what if I need to update the executable frequently? Wouldn't that complicate things?

Could you provide an example of how you might set that up in a Dockerfile? Like, how exactly would you copy the exe in?