Check if a machine is ready to run an ARM Docker image
()
| 447 | |
| 448 | |
| 449 | def check_arm_qemu() -> None: |
| 450 | """ |
| 451 | Check if a machine is ready to run an ARM Docker image |
| 452 | """ |
| 453 | machine = platform.machine().lower() |
| 454 | if "arm" in machine or "aarch64" in machine: |
| 455 | # No need to check anything if the machine runs ARM |
| 456 | return |
| 457 | |
| 458 | binfmt = Path("/proc/sys/fs/binfmt_misc") |
| 459 | if not binfmt.exists() or len(list(binfmt.glob("qemu-*"))) == 0: |
| 460 | clean_exit( |
| 461 | textwrap.dedent( |
| 462 | """ |
| 463 | You must run a one-time setup to use ARM containers on x86 via QEMU: |
| 464 | |
| 465 | sudo apt install -y qemu binfmt-support qemu-user-static |
| 466 | docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 467 | |
| 468 | See https://www.stereolabs.com/docs/docker/building-arm-container-on-x86/ for details""".strip( |
| 469 | "\n" |
| 470 | ) |
| 471 | ) |
| 472 | ) |
| 473 | |
| 474 | |
| 475 | def cli_name(s: str) -> str: |
nothing calls this directly
no test coverage detected
searching dependent graphs…