@here: hello guys! I am having some issue building...
# ask-community
a
@here: hello guys! I am having some issue building and deploying docker images using Prefect. I am using M1 chip to build the docker image, and it fails with the following error:
Copy code
failed to get destination image "xxx": image with reference xxx was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8
I have build args as: build_kwargs={"buildargs": {"PYTHON_VERSION": "3.8.12"}, "platform": ["linux/amd64"]}, can anybody please help me 🙏?
a
@agniva we usually don’t tag anyone, especially not “all here” - it would be appreciated 🙏 regarding the issue: what happens if you don’t explicitly define the platform? I would expect that under the hood the right platform would be selected
a
sure Anna, my bad 🙂 also, when i do not use the platform, it builds on M1, but upon deployment on our production environment (which is x86) it does not work with the following errors: standard_init_linux.go228 exec user process caused: exec format error
in prefect server the following error is displayed: Container <container_name> state: terminated Exit Code:: 1 Reason: Error
a
So you build the image on v8 and you push it to a container registry. When your production environment pulls it from there, it complains that it was built for a wrong platform? What is your deployment environment e.g. a Kubernetes clutser, a Docker agent on a VM?
a
kubernetes cluster.
a
The easiest solution I can think of would be to either: 1. Let the image for production be built as part of a CI/CD pipeline - this way, e.g. when you use something like CircleCI, the production image will be built in a linux environment 2. Spin up a development linux VM and register flows from there.
just found this post: https://dev.to/lakhansamani/create-docker-image-on-apple-silicon-m1-mac-2f75 how do you pass the build_kwargs? can you share your full Docker storage definition?
a
this is the full docker storage defn: storage = Docker( registry_url="osai", image_name="enrichment-flow", image_tag="mal", dockerfile=f"{BASEDIR}/.enrichment/Dockerfile.enrich", build_kwargs={"buildargs": {"PYTHON_VERSION": "3.8.12"}, "platform": ["linux/amd64"]}, python_dependencies=[ "fasttext==0.9.2" ], files={ f"{BASEDIR}/queries": "/opt/prefect/queries/", f"{BASEDIR}/enrichment": "/opt/prefect/enrichment/", }, env_vars={ "PYTHONPATH": "/opt/prefect/enrichment:/opt/prefect/queries", "PREFECT__LOGGING__LEVEL": "ERROR", }, )
a
based on this doc, I believe this should be string, rather than a list 🙂
Copy code
build_kwargs={"buildargs": {"PYTHON_VERSION": "3.8.12"}, "platform": "linux/amd64"},
upvote 1
a
thanks Anna 🙂 I was trying multiarch hence the list. I am currently trying as you suggested
👍 1
hey it builds without the error mentioned above!! i also pulled python for amd64 (bullseye-slim) and it works!! thanks a bunch Anna I have been stuck on this for a ridiculously long time thanks again, have a nice one :)
🙌 1