can i run multi services in dockerfile without using docker compose to deploy that image using docker swarm
Can i run multi services in dockerfile without using docker compose to deploy that image using docker swarm
You mean if it’s possible to create an image based on a self made dockerfile that installs and creates multiple services? From the technical perspective: sure! Is it recommended: absolutely not!
Typically a single image (and the container created from it) serves a single component that can not be further decomposed. In case of a distributed application, it must be able to communicate with the other components over a network connection.
Why do you believe a single “god image” with all services is easier to handle than running the services in their own conntainers with docker swarm?
With individual containers, you probably can leverage already available images, and just create an image for those services that you custom made. Don’t underestimate the time spend to create the Dockerfile of your god image and the continous effort to maintain it… Automation eventualy breaks, as it requires maintance to keep up with changes in the world: new base image? new service version? changed package repo? changed github repo? changed download url for components? …
Also how do you determine the stability of a contaiener with multiple services? What should happen if one of those services fail?
I feel like you think you make your life easier with a “god image” approach, but on the long run you will have quite the opposite effect. You are better of to learn how it’s supposed to be used, instead of spending extra effort in fighting the side effect that come from forcing non-container patterns to the container world.