Answer a question

  1. Why are some docker images incompatible with platforms like Raspberry Pi (linux/arm/v7)?
  2. Furthermore, can you modify a Dockerfile or another config file such that it is compatible?

Thanks for any suggestions!


So far I've installed docker and docker-compose then followed the puckel/docker-airflow readme, skipping the optional build, then tried to run the container by:

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

got this warning:

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

found this issue and ran:

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

then, this error:

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'.

Answers

Executable files, i.e. binary files, are dependent on the computer's architecture (amd64, arm...). Docker's image contains binary files. That is, the docker image is computer architecture dependent.

Therefore, if you look at the registry of docker, the OS and Architecture of the image are specified. Refer to the dockerhub/puckel/docker-airflow you used, linux/amd64 You can see it only supports. In other words, it doesn't work in arm architecture. If you want to run this arm architecture there will be several ways, but the point is one. It is to build the result of building the origin code with arm, not amd64, as docker image.


In github.com/puckel/docker-airflow, guidelines for building are well stated.

First, if you look at the Dockerfile provided by the github, it starts from the image FROM python:3.7-slim-buster. For the corresponding python:3.7-slim-buster, it supports linux/arm/v5, linux/arm/v7, linux/arm/v5, linux/arm64/v8. dockerhub/python/3.7-slim-buster

In other words, you can build to arm architecture

I have experience creating images for multiple architectures through the docker buildx command. Of course, other methods exist, but I will only briefly introduce the commands below.


dockerhub/buildx

  • docker buildx is an experimental feature, and it is still recommended Experimental features must not be used in production environments.
docker buildx build --platform linux/arm/v5,linux/arm/v7 .
Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐