The story goes like this!
- I have used
Docker Swarm mode
as an orchestration tool! - I have deployed my
live_ofbiz
service in swarm mode! - Service
live_ofbiz
contains bloated containers, with an image of size 1.25 GB. - There is some way or the other, where the container is leaking memory.
- I have limited the memory usage of the service to 6GB.
(
docker stats
) - With about 150 daily users on the application, the container is bound to die after 10-12 days, leaving a downtime of 2 minutes, when the memory limit capacity of 6GB is reached!
So my question is, is there any way through which I can set a threshold limit of 6GB, and in the meantime, a new container can launch itself and replace the live_ofbiz
's running container (just like docker service update --image ofbiz:$SAME_OLD_IMAGE_VERSION live_ofbiz
, but in an automated fashion)?
A possible solution can be adding a corn job to identify the memory limit reached, and hence triggering the update command via shell! But I would refrain from using a corn job due to some restrictions!
I'd like to know if Docker Swarm mode / Services configuration provides such a solution by default or not!
Thank you in advance! :)
--limit-memory
is literally how docker swarm supports terminating - and restarting leaking tasks. However, there is no "start-first" option for restart policy, only for--update-order
. So unless--update-order=start-first
magically applies here, it seems that you need more than 1 replica if you want continuity over the OOM / restart.