Docker in Docker doesn't seem to respect dockerfile context variable #1310
-
I can't seem to change the build context for an image build caused by the I tried just manually setting the context path since my image build is not actually dependent on build context, but it seems no matter what variable I set (environmental or in Cross.toml) the context path doesn't change. Below I tried changing the build context via the environmental variable ( 1 ❯ DOCKERFILE_CONTEXT=/home/ayrton cross build --target aarch64-unknown-linux-gnu -v
+ cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu
[cross] warning: found unused key(s) in Cross configuration:
> dockerfile
+ rustc --print sysroot
+ rustup toolchain list
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/sbin/docker
+ "/home/ayrton/capture/" /usr/sbin/docker build --label 'org.cross-rs.for-cross-target=aarch64-unknown-linux-gnu' --label 'org.cross-rs.workspace_root=/app' --tag cross-custom-app:aarch64-unknown-linux-gnu-0c35e-pre-build --build-arg 'CROSS_CMD=dpkg --add-architecture $CROSS_DEB_ARCH
apt-get update && apt-get install --assume-yes
apt-get update && apt-get install -y pkg-config libasound-dev:$CROSS_DEB_ARCH' --build-arg 'CROSS_DEB_ARCH=arm64' --file /app/target/aarch64-unknown-linux-gnu/Dockerfile.aarch64-unknown-linux-gnu-custom /home/ayrton/capture/
Error:
0: could not run container
1: when building custom image
2: when pre-building
3: could not execute `/usr/sbin/docker build --label 'org.cross-rs.for-cross-target=aarch64-unknown-linux-gnu' --label 'org.cross-rs.workspace_root=/app' --tag cross-custom-app:aarch64-unknown-linux-gnu-0c35e-pre-build --build-arg 'CROSS_CMD=dpkg --add-architecture $CROSS_DEB_ARCH
apt-get update && apt-get install --assume-yes
apt-get update && apt-get install -y pkg-config libasound-dev:$CROSS_DEB_ARCH' --build-arg 'CROSS_DEB_ARCH=arm64' --file /app/target/aarch64-unknown-linux-gnu/Dockerfile.aarch64-unknown-linux-gnu-custom /home/ayrton/capture/`
4: No such file or directory (os error 2)
Note: CROSS_CMD=dpkg --add-architecture $CROSS_DEB_ARCH
apt-get update && apt-get install --assume-yes
apt-get update && apt-get install -y pkg-config libasound-dev:$CROSS_DEB_ARCH |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This issue seems to be resolved on the master branch. Install cross via Edit: Another thing to try is playing with the |
Beta Was this translation helpful? Give feedback.
This issue seems to be resolved on the master branch. Install cross via
cargo install cross --git https://github.com/cross-rs/cross
instead.Edit: Another thing to try is playing with the
CROSS_DOCKER_IN_DOCKER
andCROSS_CONTAINER_IN_CONTAINER
environmental variables. For example I useCROSS_DOCKER_IN_DOCKER=1 CROSS_CONTAINER_IN_CONTAINER=0
.