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 support for docker.io #1560

Merged
merged 6 commits into from
Mar 19, 2019
Merged

Add support for docker.io #1560

merged 6 commits into from
Mar 19, 2019

Conversation

briandealwis
Copy link
Member

@briandealwis briandealwis commented Mar 16, 2019

Fixes #1549

  • Change RegistryAliasGroup to manage registry → host mappings.
  • Change ImageReference#getRegistry() to remap the registry; this class does other mappings, like library/ prefixing of the repository.
  • Change the default host for Docker Hub to be registry-1.docker.io
  • Added docker.io and registry-1.docker.io to the Docker Hub registry aliases in RegistryAliasGroup
    - add a toString() to LogEvent to help track down a spurious test error!

@@ -236,12 +237,12 @@ private ImageReference(String registry, String repository, String tag) {
}

/**
* Gets the registry portion of the {@link ImageReference}.
* Gets the registry host of the {@link ImageReference}.
Copy link
Member

@chanseokoh chanseokoh Mar 18, 2019

Choose a reason for hiding this comment

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

What are the consequences of this? That is, I hope jib:dockerBuild will push docker.io/some/name instead of registry-1.docker.io/some/name.

Also, should RegistryAliasGroup.getHost() be done outside of this? The getters of this class simply returns its fields as-is, and we may want to keep it that way, as an immutable class and a pure representation of the parsed reference.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good question! I did this so that ImageReference#toString() would preserve the docker.io prefix.

With this change, jib:dockerBuild -Dimage=docker.io/foo/bar/baz records the image as foo/bar/baz. But jib:buildTar -Dimage=docker.io/foo/bar/baz records the repoTag as docker.io/foo/bar/baz.

But if I do a docker build -t docker.io/foo/bar/baz ., docker reports the built image without the docker.io prefix. And the result of docker save docker.io/foo/bar/baz doesn't have docker.io either.

I'll move this remapping into parse().

@briandealwis
Copy link
Member Author

Kokoro-macos build failure occurred when the wrapper tried to download the gradle instance.

docker info
+ cd github/jib
+ rm /usr/local/bin/docker-credential-osxkeychain
+ cd jib-core
+ ./gradlew clean build integrationTest --info --stacktrace
Downloading https://services.gradle.org/distributions/gradle-4.10.2-bin.zip

Exception in thread "main" java.net.SocketException: Broken pipe (Write failed)
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
	at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
	at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
	at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:886)
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:857)
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:727)
	at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1150)
	at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1266)
	at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1178)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
	at org.gradle.wrapper.Download.downloadInternal(Download.java:66)
	at org.gradle.wrapper.Download.download(Download.java:51)
	at org.gradle.wrapper.Install$1.call(Install.java:62)
	at org.gradle.wrapper.Install$1.call(Install.java:48)
	at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
	at org.gradle.wrapper.Install.createDist(Install.java:48)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

@briandealwis briandealwis merged commit 78e7adc into master Mar 19, 2019
@briandealwis briandealwis deleted the i1549 branch March 19, 2019 14:47
@briandealwis briandealwis added this to the v1.1.0 milestone Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skaffold-Jib fails when trying to override image repository with docker.io/{account}
4 participants