Can we have a single container with multiple image like nginx + Redis + alpine ?
You can have multiple processes inside a container but it wouldn’t really be a best practice.
Having NGINX and Redis in separate containers but inside the same pod would be better. But then NGINX and Redis are tied together, so you could not form example scale NGINX.
The typically scenarios would be NGINX and Redis in separate pods.
Keep in mind I have know idea what you app architecture is, I’m just assuming a typical web server / database arch where you might want to scale the web server later.
Thanks Stephen for your answer,
I got your point, I just want to know if we have to create Pod with single container which has to use the image redis + nginx + memcached. Then below are questions:
- Is this possible?
- if yes, how to create it,. Any way interactive or yaml based ? please share the yaml file if possible
Running containers is Kubernetes responsibility.
Building containers, which is what you are describing, is Dockers (Or other runtimes) responsibility.
You need to look at Docker documentation in order to build a container with multiple processes.
This page seems to give a good overview:
Again though, I’ll advise against it.
Unless you have specific technical need, it is actually more complicated to build the container with multiple processes than it would be to run a pod with multiple single process containers. You need to manage an entry point script which will then fork and manage all the required processes.