bazelbuild / bazelbuild/rules_docker
Fail to generate ARM64 compliant docker image from Linux/aarch64 container
- Dominant language
- Starlark
- Stars
- 1.1k
- Forks
- 689
- PR merge metrics
- No merged PRs in 30d
Description
# 🐞 bug report
### Affected Rule
The issue is caused by the rule: py_image
### Is this a regression?
I cannot tell.
### Description
My Macbook M1 has a linux (aarch64 platform) docker container that has all of my project setup for bazel, and I do all development inside the container. Bazel py_image produced a tarball docker image file. Since it was built from the linux/aarch machine, I expected the tarball image to be aarch compliant. But its targeted platform is x86_64 (or amd64).
## 🔬 Minimal Reproduction
In WORKSPACE.bazel,
container_pull(
name = "python_arm64",
architecture = "arm64v8",
digest = "sha256:6d55a17e24a29d204da7d5d62b7f90f9f88691e36a09add24a287dc10ec46bd1",
registry = "index.docker.io",
repository = "python:3.10",
)
In BUILD.bazel,
py_binary(
name = "python_shell_simple",
srcs = ["python_shell_simple.py"],
main = "python_shell_simple.py",
python_version = "PY3ONLY",
srcs_version = "PY3ONLY",
deps = [
requirement("botocore"),
requirement("boto3"),
],
)
Then run this command,
$ bazel build //batch/file_process:python_shell_simple_image.tar
Copy the tar file to host machine. In my case, Apple M1 macos' filesystem. Load the docker image.
$ docker load -i python_shell_simple_image.tar
Launch a new docker container.
docker run --rm -it bazel/batch/file_process:python_shell_simple_image
## 🔥 Exception or Error
**WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested**
## 🌍 Your Environment
**Operating System:**
Ubuntu linux/aarch64 container running in Macbook M1 Monterey MacOS.
**Output of `bazel version`:**
6.0.0
**Rules_docker version:**
v0.25.0
**Anything else relevant?**
Contributor guide
Assessment
This issue has not been assessed yet.