Does CircleCI Docker executor preserve environment variables across re-queued jobs?
24K reputation · 06 Feb 2026, 19:24 UTC
When utilizing the Docker executor in CircleCI, jobs are designed to run in isolated containers. A common requirement is the ability to maintain state or transient environment variables when a job is re-queued following a failure.
Current documentation indicates that containers restart with a clean environment. While persist_to_workspace and save_cache are available for filesystem artifacts, it is unclear how to handle dynamic environment variables that were generated during a previous execution attempt without manually committing them to a file.
Given these constraints, what is the recommended mechanism for ensuring that dynamically set environment variables persist across a re-queued job execution in the Docker executor? Does CircleCI provide a native way to inherit the environment state from a failed attempt, or must all variables be externalized to the workspace?