Problem with intermediate Image in docker build for varying Architectures with same Base Image

Aperta
#13,681 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
docker, python

Direzione di ricerca

Non sono indicati file sorgente né test. Inizia riproducendo i comandi di build Docker concorrenti per linux/arm/v7 e linux/amd64 descritti nell’issue, quindi esamina la gestione delle immagini intermedie da parte di Docker alla ricerca di riferimenti specifici della piattaforma. Il lavoro sarà considerato completato quando sarà disponibile un workaround o un fix documentato e verificato che impedisca alle build concorrenti di selezionare un’immagine per la piattaforma sbagliata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area/build lifecycle/frozen

In my system, I need to create a large number of images for different devices with different architectures. For this, I have a pipeline that creates multiple images using Docker in Docker, all based on one Python:3.8 image, but for different architectures. In the Docker file, I specify the base image in general:

FROM python:3.8

In the build command, I specify the architecture of the particular device:

docker build --platform linux/arm/v7 --force-rm -t localhost:5000/ImageName

docker build --platform linux/amd64 --force-rm -t localhost:5000/ImageName

The problem I'm facing at the moment is that the Docker host gets confused with the images when the pipeline triggers both or more builds at the same time. Docker doesn't seem to be able to store intermediate images for different architectures because they only differ in digest and identical tags are overwritten. For this reason, docker only seems to select the intermediate image by the name and tag and not by the sha265: that matches the architecture. This results in the following error:

failed to get destination image "sha256:4d470a81cd7a4eb2a886d8d6ca7848d66f711ea2d44375f4ab10a97c42c1adf3": image with reference sha256: 4d470a81cd7a4eb2a886d8d6ca7848d66f711ea2d44375f4ab10a97c42c1adf3 was found but does not match the specified platform: wanted linux/arm/v7, actual: linux/amd64

Also the --force-rm option in the build command does not work here, because the deletion is done after the build process is finished. I also don't want to declare the images with @sha in the dockerfile, because the identical code should be used on different devices.

What is the best way to work around or solve this problem?

Lingua principale
Markdown
Stelle
4.7k
Fork
8.5k
Merge medio
2g 8h
PR unite (30g)
129

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di docker/docs

Tutte le issue di docker/docs

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.