cross-rs/cross · warning
using both `CROSS_CONTAINER_IN_CONTAINER` and…
Error message
using both `CROSS_CONTAINER_IN_CONTAINER` and `CROSS_DOCKER_IN_DOCKER`.
What it means
in_docker reads the container-in-container flag. `CROSS_DOCKER_IN_DOCKER` is the deprecated name and `CROSS_CONTAINER_IN_CONTAINER` the engine-agnostic one. Setting both is ambiguous, so cross warns and continues, preferring the new variable's value.
Solutions
- Remove CROSS_DOCKER_IN_DOCKER from your environment and keep only CROSS_CONTAINER_IN_CONTAINER.
- Update CI pipelines, Makefiles, and shell profiles that still export the deprecated variable.
- If both must be handled temporarily, ensure they hold the same value so the ambiguity is harmless.
Example fix
// before export CROSS_CONTAINER_IN_CONTAINER=1 export CROSS_DOCKER_IN_DOCKER=1 // after export CROSS_CONTAINER_IN_CONTAINER=1
Defensive patterns
Strategy: validation
Validate before calling
# in CI or shell profile if [ -n "$CROSS_DOCKER_IN_DOCKER" ] && [ -n "$CROSS_CONTAINER_IN_CONTAINER" ]; then echo "Set only CROSS_CONTAINER_IN_CONTAINER"; exit 1 fi
Prevention
- Standardize on CROSS_CONTAINER_IN_CONTAINER everywhere
- Grep CI configs and dotfiles for the deprecated variable periodically
When it happens
Trigger: Calling in_docker (during any cross run that queries the engine mode) with both CROSS_CONTAINER_IN_CONTAINER and CROSS_DOCKER_IN_DOCKER present in the environment.
Common situations: Shell profile or CI config set the old variable and the user/tooling later added the new one; migrating scripts from old cross versions where CROSS_DOCKER_IN_DOCKER was the only name.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- CROSS_RUNNER environment variable name is reserved and…
- remote and docker-in-docker are unlikely to work together…
- Refusing to push without tag or branch. Specify a…
- unexpected progress type: expected plain, auto, or tty and…
- cannot make definite Image from unqualified PossibleImage
AI-assisted analysis of cross-rs/cross@8c1a8aa4b6 (2026-09-13).
Data as JSON: /api/errors/45fd4f0aaf9712a2.
Report an issue: GitHub.
Appendix: source
Thrown at src/docker/engine.rs:120
kind,
in_docker,
arch,
os,
is_remote,
is_rootless,
})
}
#[must_use]
pub fn needs_remote(&self) -> bool {
self.is_remote && self.kind == EngineType::Podman
}
pub fn in_docker(msg_info: &mut MessageInfo) -> Result<bool> {
Ok(
if let Ok(value) = env::var("CROSS_CONTAINER_IN_CONTAINER") {
if env::var("CROSS_DOCKER_IN_DOCKER").is_ok() {
msg_info.warn(
"using both `CROSS_CONTAINER_IN_CONTAINER` and `CROSS_DOCKER_IN_DOCKER`.",
)?;
}
bool_from_envvar(&value)
} else if let Ok(value) = env::var("CROSS_DOCKER_IN_DOCKER") {
// FIXME: remove this when we deprecate CROSS_DOCKER_IN_DOCKER.
bool_from_envvar(&value)
} else {
false
},
)
}
#[must_use]
pub fn is_remote() -> bool {
env::var("CROSS_REMOTE")
.map(|s| bool_from_envvar(&s))
.unwrap_or_default()View on GitHub (pinned to 8c1a8aa4b6)