cancel
The cancel step type stops and removes a background container service that an earlier step started with background: true. It gives you explicit, in-workflow teardown for long-running dependencies — emulators, databases, registries — without dropping into shell scripts to track and kill container IDs.
Name the background service to stop with the for field. Atmos gracefully stops the container and removes it:
steps:
- name: emulator
type: container
action: run
background: true
with:
image: localstack/localstack
ports:
- host: 4566
container: 4566
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
interval: 5s
retries: 10
start_period: 30s
- name: apply
type: atmos
command: terraform apply vpc -s dev
- type: cancel
for: emulator
Fields
for- Name of the background service step to stop and remove. Must reference an earlier
action: runstep withbackground: true. The container is gracefully stopped, then removed.
Automatic teardown
A cancel step is optional. If you never cancel a background service explicitly, Atmos automatically tears down all background services when the workflow ends — including on failure — so a crashed or short-circuited workflow does not leave orphaned containers running. Use cancel when you want to free a service early, before the workflow finishes, or to make teardown explicit in the workflow file.
See background services on the container step page for the full lifecycle, and wait for gating steps on service readiness.