I have installed docker swarm on an ubuntu machine on aws. After that, I have spinned up few services on that. After few services the machine got hang and unable to connect. Everytime, I need to restart the machine and the containers are getting created again because of this. Is there any way to restrict the docker swarm services to use only 50% percent of CPU or memory so that my main machine won't get hung up.?
And also, when I restart the machine, the services are creating new containers, any option to use the existing ones only without creating new ones.