Docker Community Forums

Share and learn in the Docker community.

If you run multiple containers of the same image, or similar images with similar core/base, does each container run its own instance/copy of the necessary core/base functions?

Say I have an image that opens a shell, writes the current date to a file, sleeps 60 seconds, and loops.

If I run multiple instances of the image, multiple containers, does that mean my system is running multiple instances of the shell and my script?

I ask because I see a lot of images for light-weight services – but those light-weight services need the same/similar core/base functions. In those cases, wouldn’t it make more sense for me to create my own image with all of the light-weight services – all using the same core/base functions? Wouldn’t that be more efficient.

And yes, I know it is painful to create an image that runs multiple services – but it is possible.


Yep. DRY is always a good idea :slight_smile: Depending on the design of your images, you might still end up running multiple instanxes of your script…

Just because you have the freedom to shoot yourself in the foot, doesn’t mean that you’ll like the outcome. Just don’t! … that is of course unless there is an inevitable reason to do so…

1 Like

So I guess there is a balance to be had. I might try to create my own image for Plex and a few related services – just for learning purposes.

Thank you!

Just out of curriousity: what improvements do you have in mind?

Also, if you adopt the official PMS image, be aware that they use s6-overlay as init system, which follows a convention where files need to be located in your image.

Well, I don’t know yet. My thought is, Sonarr, Radarr and SabNZBD are all rather light-weight – idle 95% of the day. Instead of having 4 containers for them (including Plex), why not put it in one image. I mean, I don’t know if the performance cost will be worth it but I’m game to try it out and see. Plus, that way I’ll better learn Docker.

Appart from have a fun exercise, I am not sure if you actualy gain any benefit from the endavor - remember: only the required processes are started and running. Though, on the other side you create yourself a harder maintainable beast of an image. Seperation of concerns realy is a thing :slight_smile:

I feel the time spend to work on clever compose-files or even learn kubernets is effectivly better spend then creating your personal maintanance hell.