Files
docker-docs/docker-cloud/apps/auto-destroy.md
Misty Stanley-Jones a4f5e30249 Various copyedits to reduce future tense, wordiness, and use of 'please' (#5788)
* Reword lots of instances of 'will'

* Reword lots of instances of won't

* Reword lots of instances of we'll

* Eradicate you'll

* Eradicate 'be able to' type of phrases

* Eradicate 'unable to' type of phrases

* Eradicate 'has / have to' type of phrases

* Eradicate 'note that' type of phrases

* Eradicate 'in order to' type of phrases

* Redirect to official Chef and Puppet docs

* Eradicate gratuitous 'please'

* Reduce use of e.g.

* Reduce use of i.e.

* Reduce use of N.B.

* Get rid of 'sexagesimal' and correct some errors
2018-01-25 17:37:23 -08:00

2.4 KiB

description, keywords, redirect_from, title
description keywords redirect_from title
Autodestroy Autodestroy, service, terminate, container
/docker-cloud/feature-reference/auto-destroy/
Destroy containers automatically

When enabled on a service, Autodestroy automatically terminates containers when they stop. This destroys all data in the container on stop. This is useful for one-time actions that store their results in an external system.

The following Autodestroy options are available:

  • OFF: the container remains in the Stopped state regardless of exit code, and is not destroyed.
  • ON_SUCCESS: if the container stops with an exit code of 0 (normal shutdown), Docker Cloud automatically destroys it. If it stops with any other exit code, Docker Cloud leaves it in the Stopped state.
  • ALWAYS: if the container stops, Docker Cloud automatically terminates it regardless of the exit code.

If Autorestart is activated, Docker Cloud evaluates whether to try restarting the container or not before evaluating Autodestroy.

Launch a service with Autodestroy

You can enable Autodestroy on the Service configuration step of the Launch new service wizard.

Autodestroy is set to OFF (deactivated) by default.

Use the API or CLI

You can enable autodestroy when launching a service through the API or CLI.

If not provided, it has a default value of OFF. Check our API documentation for more information.

Launch with autodestroy using the API

POST /api/app/v1/service/ HTTP/1.1
{
	 "autodestroy": "ALWAYS",
	 [...]
}

Launch with autodestroy using the CLI

$ docker-cloud service run --autodestroy ALWAYS [...]

Enable autodestroy on an already deployed service

You can also activate or deactivate the Autodestroy setting on a service after it has been deployed, by editing the service.

  1. Go to the service detail page.
  2. Click Edit.
  3. Select the new autodestroy setting.
  4. Click Save.

Use the API or CLI

You can set the Autodestroy option after the service has been deployed, using the API or CLI.

Check our API documentation for more information.

Enable autodestroy using the API

PATCH /api/app/v1/service/(uuid)/ HTTP/1.1
{
	"autodestroy": "ALWAYS"
}

Enable autodestroy using the CLI

$ docker-cloud service set --autodestroy ALWAYS (name or uuid)