Draft: Multi-Architecture CentOS 7 Base Image, master branch (2023.02.08.)
In an effort to better support the various aarch64
nightlies, this MR is an attempt to make atlas/centos7-atlasos "multi-platform". At the same time I want to use this MR as a way of documenting what I did with all of this so far.
Much of what I did is based on these 2 "things":
- https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
- https://stackoverflow.com/questions/43654656/dockerfile-if-else-condition-with-external-arguments
Using all the updates of this MR, I built the very latest version (at least at the time of writing) of krasznaa/centos7-atlasos:testing with:
- On an M1 Mac Mini I installed Docker Desktop, and enabled experimental features for Docker Engine in it.
- I prepared a "buildx environment" in my terminal with (this was particularly painful to figure out...):
docker buildx create --name ATLASBuilder
docker buildx use ATLASBuilder
docker buildx inspect --bootstrap
- I then built and uploaded the multi-architecture image with:
docker buildx build --push --platform linux/amd64,linux/arm64/v8 --tag krasznaa/centos7-atlasos:testing --compress --squash ./docker/centos7-atlasos/
It's also possible to follow the "more complicated" recipe from my first link, but that unfortunately forces you into first uploading single-architecture images into DockerHub before you could combine them into a single multi-architecture one. (I was very surprised/disappointed about this.) The recipe for doing that was the following:
docker build --platform linux/amd64 -t krasznaa/centos7-atlasos:testing-amd64 --compress --squash ./docker/centos7-atlasos/
docker push krasznaa/centos7-atlasos:testing-amd64
docker build --platform linux/arm64/v8 -t krasznaa/centos7-atlasos:testing-arm64 --compress --squash ./docker/centos7-atlasos/
docker push krasznaa/centos7-atlasos:testing-arm64
docker manifest create krasznaa/centos7-atlasos:testing --amend krasznaa/centos7-atlasos:testing-amd64 --amend krasznaa/centos7-atlasos:testing-arm64
docker manifest push krasznaa/centos7-atlasos:testing
Now... I still don't know what's the way to do this properly. I basically don't like either of these methods. docker build
directly seems to produce smaller compressed images.
Pinging @elmsheus.