Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public class DockerClientConfig implements Serializable {
CONFIG_KEYS.add(REGISTRY_URL);
}

private URI dockerHost;
private final URI dockerHost;

private final String registryUsername, registryPassword, registryEmail, registryUrl, dockerConfig, dockerCertPath;

private boolean dockerTlsVerify;
private final boolean dockerTlsVerify;

private final RemoteApiVersion apiVersion;

Expand Down Expand Up @@ -238,10 +238,6 @@ public URI getDockerHost() {
return dockerHost;
}

public void setDockerHost(URI dockerHost) {
this.dockerHost = dockerHost;
}

public RemoteApiVersion getApiVersion() {
return apiVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ public void init(DockerClientConfig dockerClientConfig) {
protocol = "http";
}

if (originalUri.getScheme().equals("unix")) {
dockerClientConfig.setDockerHost(UnixConnectionSocketFactory.sanitizeUri(originalUri));
} else {
if (!originalUri.getScheme().equals("unix")) {

try {
originalUri = new URI(originalUri.toString().replaceFirst("tcp", protocol));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}

configureProxy(clientConfig, protocol);
}

Expand Down Expand Up @@ -209,7 +209,14 @@ public void init(DockerClientConfig dockerClientConfig) {

client = clientBuilder.build();

baseResource = client.target(originalUri.toString()).path(dockerClientConfig.getApiVersion().asWebPathPart());
baseResource = client.target(sanitizeUrl(originalUri).toString()).path(dockerClientConfig.getApiVersion().asWebPathPart());
}

private URI sanitizeUrl(URI originalUri) {
Copy link
Member

Choose a reason for hiding this comment

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

Please provide some javadoc to get idea why it critical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, don't know what you mean.

Copy link
Member

Choose a reason for hiding this comment

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

well, ok, ignore.

if (originalUri.getScheme().equals("unix")) {
return UnixConnectionSocketFactory.sanitizeUri(originalUri);
}
return originalUri;
}

private void configureProxy(ClientConfig clientConfig, String protocol) {
Expand Down