cross-rs/cross · error
using both `CROSS_CONTAINER_OPTS` and `DOCKER_OPTS`.
Error message
using both `CROSS_CONTAINER_OPTS` and `DOCKER_OPTS`.
What it means
Warning emitted when the user has set both CROSS_CONTAINER_OPTS and DOCKER_OPTS in the environment. CROSS_CONTAINER_OPTS is the supported, engine-agnostic variable; DOCKER_OPTS is the older Docker-only one. Setting both is ambiguous because only one can take effect, so cross warns and proceeds rather than silently ignoring the configuration.
Solutions
- Unset DOCKER_OPTS and keep only CROSS_CONTAINER_OPTS so the options apply regardless of the container engine used
- If you specifically rely on DOCKER_OPTS semantics, remove CROSS_CONTAINER_OPTS to silence the warning
- Move the shared options into cross's configuration file instead of environment variables to avoid the conflict
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/docker/shared.rs:1034 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cross-rs/cross@8c1a8aa4b6 (2026-09-13).
Data as JSON: /api/errors/6b44095edeae5955.
Report an issue: GitHub.
Appendix: source
Thrown at src/docker/shared.rs:1034
.args([
"-e",
&format!("CROSS_RUST_SYSROOT={}", dirs.sysroot_mount_path()),
])
.args(["-e", "CARGO_TARGET_DIR=/target"])
.args(["-e", &cross_runner]);
if options.command_variant.uses_zig() {
// otherwise, zig has a permission error trying to create the cache
self.args(["-e", "XDG_CACHE_HOME=/target/.zig-cache"]);
}
self.add_configuration_envvars();
if let Some(username) = id::username().wrap_err("could not get username")? {
self.args(["-e", &format!("USER={username}")]);
}
if let Ok(value) = env::var("CROSS_CONTAINER_OPTS") {
if env::var("DOCKER_OPTS").is_ok() {
msg_info.warn("using both `CROSS_CONTAINER_OPTS` and `DOCKER_OPTS`.")?;
}
self.args(&Engine::parse_opts(&value)?);
} else if let Ok(value) = env::var("DOCKER_OPTS") {
// FIXME: remove this when we deprecate DOCKER_OPTS.
self.args(&Engine::parse_opts(&value)?);
};
let (major, minor, patch) = match options.rustc_version.as_ref() {
Some(version) => (version.major, version.minor, version.patch),
// no toolchain version available, always provide the oldest
// compiler available. this isn't a major issue because
// linking with libgcc will not include symbols found in
// the builtins.
None => (1, 0, 0),
};
self.args(["-e", &format!("CROSS_RUSTC_MAJOR_VERSION={}", major)]);
self.args(["-e", &format!("CROSS_RUSTC_MINOR_VERSION={}", minor)]);
self.args(["-e", &format!("CROSS_RUSTC_PATCH_VERSION={}", patch)]);View on GitHub (pinned to 8c1a8aa4b6)