Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiversion and multiarch support (no more committed binaries) #74

Closed
wants to merge 1 commit into from

Conversation

tianon
Copy link
Contributor

@tianon tianon commented May 22, 2018

This adapts the main https://github.com/docker/distribution Dockerfile into a single RUN line so that we build the registry binary as part of this image build (since we're FROM alpine now and can do that), which not only makes it much more trivial to bump the version, but also makes it possible to support more architectures (I personally tested s390x and arm64v8 successfully).

I also added an explicit Dockerfile for 2.5 since it's still supported (https://github.com/docker-library/official-images/blob/87bf0e793eb5e3bf5c3384baaeb54a6c696677a1/library/registry), and updated to Alpine 3.7.

Closes #48
Closes #54
Closes #56
Closes #59
Closes #60
Closes #62
Closes #64
Closes #73

Here's an example of how I'd structure library/registry if this were merged, taking advantage of the newer file format to support Architectures: (happy to make that PR too, if you'd like!)

Maintainers: Stephen Day <stephen.day@docker.com> (@stevvooe),
             Olivier Gambier <olivier.gambier@docker.com> (@dmp42),
             Richard Scothern <richard.scothern@gmail.com> (@RichardScothern),
             Aaron Lehmann <aaron.lehmann@docker.com> (@aaronlehmann),
             Derek McGowan <dmcg@drizz.net> (@dmcgowan)
GitRepo: https://github.com/docker/distribution-library-image.git
GitCommit: deadbeefdeadbeefdeadbeefdeadbeef
# these arches come directly from the supported list on "alpine:3.7"
Architectures: amd64, arm32v6, arm64v8, i386, ppc64le, s390x

Tags: 2.6.2, 2.6, 2, latest
Directory: 2.6

Tags: 2.5.2, 2.5
Directory: 2.5

@tianon
Copy link
Contributor Author

tianon commented May 24, 2018

cc @stevvooe, @dmp42, @RichardScothern, @aaronlehmann, @dmcgowan -- is this still an accurate Maintainers: list for the registry image? 🙏 ❤️

@dmp42
Copy link
Contributor

dmp42 commented May 24, 2018

You can definitely remove Richard.
As for the rest, let's keep it as-is for now (we'll likely change it at a later point).
Thanks @tianon !

@tianon
Copy link
Contributor Author

tianon commented May 24, 2018

Ok, thanks! How about this PR? Is this a sane direction? 🙏

@dmp42
Copy link
Contributor

dmp42 commented May 25, 2018

I guess the concern here would be the size of the resulting image would increase (right?).
Building separately and copying the binary was the original motivation for this.

wdyt?

@tianon
Copy link
Contributor Author

tianon commented May 25, 2018

I did build tests and the image size was identical, but I'll get exact numbers as soon as I'm back at my computer. 👍

@tianon
Copy link
Contributor Author

tianon commented May 25, 2018

Since we do apk add ..., make ..., apk del ..., and rm ... in the same layer, we're able to achieve the same result as COPY without having a pre-compiled binary (which thus allows for supporting multiple platforms more trivially):

$ docker images registry
REPOSITORY	TAG	IMAGE ID	CREATED		SIZE
registry	2.5-new	67f17c192bbe	2 minutes ago	32.2MB
registry	2.6-new	5a66651566bc	2 minutes ago	32.9MB
registry	2.5	36e3b1f8d3f1	4 months ago	37.8MB
registry	2.6	d1fd7d86a825	4 months ago	33.3MB

Here's sizes on arm64v8 and s390x for comparison:

$ docker images registry
REPOSITORY	TAG	IMAGE ID	CREATED		SIZE
registry	2.5-new	0cc8a98c5044	2 days ago	30.8MB
registry	2.6-new	37885a128820	2 days ago	31.4MB
$ docker images registry
REPOSITORY	TAG	IMAGE ID	CREATED		SIZE
registry	2.5-new	79ff8fa06c84	10 seconds ago	33MB
registry	2.6-new	ae4437e6611e	15 seconds ago	33.6MB

@dmp42
Copy link
Contributor

dmp42 commented May 25, 2018

Sweet. That's great.

LGTM then.

@dmp42
Copy link
Contributor

dmp42 commented May 25, 2018

@dmcgowan can you have a quick look?

cc @docker/dtr

@tianon
Copy link
Contributor Author

tianon commented Jun 5, 2018

Friendly ping ❤️

@dmp42
Copy link
Contributor

dmp42 commented Jun 5, 2018

Will do the cats herding :-)

rm -rf "$GOPATH"; \
apk del .build-deps; \
# smoke test
registry --version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't a multi-stage build be a cleaner way to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FSVO, see docker-library/official-images#3383 for why we can't ATM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do you expect to upgrade the build infrastructure to use buildkit? It seems like that would address most the performance issues and make any arguments for using these hacky one liner RUN commands irrelevant. I don't mind merging this now to get multi-arch support but multi-stage build files would make this much cleaner and easier to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build infrastructure uses docker build directly, but building the Dockerfile is only part of the coordination problem outlined there -- we've got a lot of other tooling and scripts on top that help organize and schedule the builds that need changes to support multi-stage builds (and even getting an accurate accounting of all the places that might need changes is a tall order since it isn't always obvious).

@dmcgowan
Copy link
Contributor

dmcgowan commented Jun 6, 2018

My primary concern is there seems to be no control of the Go version used to build these images. For 2.5 I am not sure we have ever tested building and running with go 1.9 or 1.10. And not sure about 2.6 either. It would be preferable to build the images with the golang:1.10.2-alpine3.7 or golang:1.9.6-alpine3.7 explicitly with multi stage builds, build stability and correctness seems way more important than any concerns over image cache size...

@tianon
Copy link
Contributor Author

tianon commented Jun 7, 2018

One simple-ish solution would be to publish "official" static binaries upstream -- then this image would be simpler (just downloading the static binary into the right place).

@lag-linaro lag-linaro mentioned this pull request Jul 5, 2018
@lag-linaro
Copy link

Morning @tianon, how is this PR progressing?

It seems as though the desire for ARM64 support is high. Do we know what's blocking?

@tianon
Copy link
Contributor Author

tianon commented Jul 5, 2018 via email

@lag-linaro
Copy link

Many of the projects I've encountered use pre-built binaries. Setting up a build, test & publish infra shouldn't be too difficult and would pay dividends with respect to testing and assured functionality.

@lag-linaro
Copy link

@tianon, producing pre-built binaries, although better in the long run, seems a long way off.

What is stopping us from using Derek's solution of specifying the Go version?

Would it then unblock this PR for acceptance and ensure multi-arch on this project?

@lag-linaro
Copy link

Works on my ARM64 platform.

Tested-by: Lee Jones lee.jones@linaro.org

@lag-linaro
Copy link

I've had this PR sitting in CI for a few weeks now. Still working.

@lag-linaro
Copy link

@tianon anything stopping you changing the base to golang:1.10.2-alpine3.7 as suggested by @dmcgowan?

@everflux
Copy link

Please merge this to provide arm images.

@jsrz
Copy link

jsrz commented Sep 21, 2018

Any update on this commit getting merged? I just tested it out and works.

I figure we want this merged since the registry is a fundamental image to the entire Docker ecosystem.

@shubham2892
Copy link

Is there a timeline for this to merge?

@lag-linaro
Copy link

Yes please. Lots of requests for this now. 😃

@lag-linaro
Copy link

Still waiting after all these months, despite so much interest. 😞

What's blocking this guys?

@lag-linaro
Copy link

Is there anything I can do to help push this along?

@davidswu
Copy link
Contributor

davidswu commented Dec 4, 2018

Closing this in favor of #81 to support multiversion multiarch

@tdaleibm
Copy link

This branch was closed in favor of the #81 regarding arm, but s390x is still not available. Can this be reopened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants