Docker Community Forums

Share and learn in the Docker community.

Docker cloud automatically modifies stack definition


(Jesus) #1

Hello,

I am currently on a trial/free account, and just added a new service to my stack. With this, I have three services (postgres, a web frontend and a container running jobs). The problem is that whenever the latter starts, it gets automatically stopped after a few minutes.

If I try to run it again, I get an error, and this in the logs:

ERROR: Service cannot be deployed with less than one container

Then, if I check my stack definition, I see that target_num_containers: 0 has been added to the service that I am trying to start.

Could you explain why this happens? Is it because of the trial account? Is there a limit on # of containers for this type of accounts?

Thanks,

Jesús


(Fernando Mayo) #2

You have activated “autodestroy”, which scales down the service each time a container finishes and gets terminated. If you want to create a new container within an “autodestroy” service, you have to scale up the service.


(Jesus) #3

Thanks Fernando.

I removed the autodestroy=always option from the stack definition and it does the trick.

Just out of curiosity, when does the autodestroy option get applied? Assume that autodestroy=always, which of these would be true?

  • if the service is redeployed, the old container will be removed
  • if the service is stopped, the old container is removed
  • if a container runs for a while (maybe to perform a one-off task), then it stops, and hence, it’s removed

Is there any other case?


(Fernando Mayo) #4

The autodestroy option gets applied when a container stops. Service redeployment always destroys old containers. See https://docs.docker.com/docker-cloud/apps/auto-destroy/ for more info.