{"record":{"id":"45fd4f0aaf9712a2","repo":"cross-rs/cross","slug":"using-both-cross-container-in-container-and-cross-docker-in","errorCode":null,"errorMessage":"using both `CROSS_CONTAINER_IN_CONTAINER` and `CROSS_DOCKER_IN_DOCKER`.","messagePattern":"using both `CROSS_CONTAINER_IN_CONTAINER` and `CROSS_DOCKER_IN_DOCKER`\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/docker/engine.rs","lineNumber":120,"sourceCode":"            kind,\n            in_docker,\n            arch,\n            os,\n            is_remote,\n            is_rootless,\n        })\n    }\n\n    #[must_use]\n    pub fn needs_remote(&self) -> bool {\n        self.is_remote && self.kind == EngineType::Podman\n    }\n\n    pub fn in_docker(msg_info: &mut MessageInfo) -> Result<bool> {\n        Ok(\n            if let Ok(value) = env::var(\"CROSS_CONTAINER_IN_CONTAINER\") {\n                if env::var(\"CROSS_DOCKER_IN_DOCKER\").is_ok() {\n                    msg_info.warn(\n                        \"using both `CROSS_CONTAINER_IN_CONTAINER` and `CROSS_DOCKER_IN_DOCKER`.\",\n                    )?;\n                }\n                bool_from_envvar(&value)\n            } else if let Ok(value) = env::var(\"CROSS_DOCKER_IN_DOCKER\") {\n                // FIXME: remove this when we deprecate CROSS_DOCKER_IN_DOCKER.\n                bool_from_envvar(&value)\n            } else {\n                false\n            },\n        )\n    }\n\n    #[must_use]\n    pub fn is_remote() -> bool {\n        env::var(\"CROSS_REMOTE\")\n            .map(|s| bool_from_envvar(&s))\n            .unwrap_or_default()","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/engine.rs#L102-L138","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nexport CROSS_CONTAINER_IN_CONTAINER=1\nexport CROSS_DOCKER_IN_DOCKER=1\n\n// after\nexport CROSS_CONTAINER_IN_CONTAINER=1","handlingStrategy":"validation","validationCode":"# in CI or shell profile\nif [ -n \"$CROSS_DOCKER_IN_DOCKER\" ] && [ -n \"$CROSS_CONTAINER_IN_CONTAINER\" ]; then\n  echo \"Set only CROSS_CONTAINER_IN_CONTAINER\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on CROSS_CONTAINER_IN_CONTAINER everywhere","Grep CI configs and dotfiles for the deprecated variable periodically"],"tags":["environment","docker","deprecated","conflicting-options"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}