运行 puckel/docker-airflow 图片在 Raspberry Pi

Running puckel/docker-airflow image on Raspberry Pi

  1. 为什么有些 docker 图片与 Raspberry Pi (linux/arm/v7) 等平台不兼容?
  2. 此外,您能否修改 Dockerfile 或其他配置文件使其兼容?

感谢您的任何建议!


到目前为止,我已经 installed docker and docker-compose then followed the puckel/docker-airflow readme,跳过可选构建,然后尝试 运行 容器:

docker run -d -p 8080:8080 puckel/docker-airflow webserver

收到此警告:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm/v7) and no specific platform was requested

找到 this issue 和 运行:

docker run -d -p 8080:8080 --platform linux/arm/v7 puckel/docker-airflow:latest webserver

然后,这个错误:

docker: Error response from daemon: image with reference puckel/docker-airflow:latest was found but does not match the specified platform: wanted linux/arm/v7, actual: linux/amd64.
See 'docker run --help'.

可执行文件,即二进制文件,取决于计算机的体系结构(amd64、arm...)。 Docker 的图像包含二进制文件。也就是说,docker 图像依赖于计算机体系结构。

因此,如果您查看 docker 的注册表,则会指定映像的 OS 和架构。参考你用的dockerhub/puckel/docker-airflowlinux/amd64可以看到只支持。换句话说,它在 arm 架构中不起作用。 如果你想运行这种arm架构会有几种方法,但重点是一种。是用arm构建源代码的结果,不是amd64,如docker image.


github.com/puckel/docker-airflow 中,对构建指南进行了详细说明。

首先,如果您查看 github 提供的 Dockerfile,它从图像 FROM python:3.7-slim-buster 开始。对于对应的python:3.7-slim-buster,支持linux/arm/v5linux/arm/v7linux/arm/v5linux/arm64/v8dockerhub/python/3.7-slim-buster

换句话说,您可以构建到 arm 架构

我有通过 docker buildx 命令为多种架构创建图像的经验。当然还有其他的方法,下面只简单介绍一下命令。


dockerhub/buildx

  • dockerbuildx是一个实验性的功能,还是推荐Experimental features must not be used in production environments
docker buildx build --platform linux/arm/v5,linux/arm/v7 .