GoogleContainerTools / GoogleContainerTools/jib
[Jib][Gradle] Custom docker client is not usable due to checks
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Jib has really nice feature to plugin custom DockerClient implementation.
However jib-gradle-plugin is overchecking DockerClient installation conditions:
```java
boolean isDockerInstalled =
dockerExecutable == null
? CliDockerClient.isDefaultDockerInstalled()
: CliDockerClient.isDockerInstalled(dockerExecutable);
if (!isDockerInstalled) {
throw new GradleException(
HelpfulSuggestions.forDockerNotInstalled(HELPFUL_SUGGESTIONS_PREFIX));
}
```
ref: [BuildDockerTask](https://github.com/GoogleContainerTools/jib/blob/9027c8dafb8ee12b9d37e1521caf62dfbcc3d374/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java#L100)
It basically means that if no executable in system, then BuildDockerTask nuke itself. The behavior is wrong as there may be custom DockerClient waiting.
[My ugly hackfix ](https://github.com/bademux/jib-java-docker-client/blob/master/src/main/java/dockerclient/FallbackToJavaDockerClient.java#L26) is to fake binary as '/bin/true'.
upd: on CI you may need to add\alter env var with job prop `GRADLE_OPTS: '-Djib.dockerClient.executable=/bin/true'`
Could you please fix the issue and thanks for the great feature, I hope java DockerClient will be part of jib ones.
ref: https://github.com/GoogleContainerTools/jib/issues/3571
Contributor guide
Assessment
This issue has not been assessed yet.