Info dockerInfo = client.infoCmd().exec(); Version version = client.versionCmd().exec(); activeApiVersion = version.getApiVersion(); activeExecutionDriver = dockerInfo.getExecutionDriver(); log.info("Connected to docker: \n" +
public VersionAssert hasApiVersion(String apiVersion) { isNotNull(); if (!Objects.areEqual(this.actual.getApiVersion(), apiVersion)) { failWithMessage("Expected docker's apiVersion to be %s but was %s", apiVersion, this.actual.getApiVersion()); } return this; }
public FormValidation doTestConnection( @QueryParameter String uri, @QueryParameter String credentialsId, @QueryParameter String apiVersion, @QueryParameter int connectTimeout, @QueryParameter int readTimeout ) { try { final DockerServerEndpoint dsep = new DockerServerEndpoint(uri, credentialsId); final DockerAPI dapi = new DockerAPI(dsep, connectTimeout, readTimeout, apiVersion, null); try(final DockerClient dc = dapi.getClient()) { final VersionCmd vc = dc.versionCmd(); final Version v = vc.exec(); final String actualVersion = v.getVersion(); final String actualApiVersion = v.getApiVersion(); return FormValidation.ok("Version = " + actualVersion + ", API Version = " + actualApiVersion); } } catch (Exception e) { return FormValidation.error(e, e.getMessage()); } } }
private void configureDockerExecutor() { when(version.getVersion()).thenReturn("1.1.0"); when(version.getOperatingSystem()).thenReturn("linux"); when(version.getKernelVersion()).thenReturn("3.1.0"); when(version.getApiVersion()).thenReturn("1.12"); when(version.getArch()).thenReturn("x86"); when(dockerClientExecutor.dockerHostVersion()).thenReturn(version); }
Info dockerInfo = client.infoCmd().exec(); Version version = client.versionCmd().exec(); activeApiVersion = version.getApiVersion(); activeExecutionDriver = dockerInfo.getExecutionDriver(); log.info("Connected to docker: \n Server Version: " + dockerInfo.getServerVersion() + "\n API Version: " + activeApiVersion + "\n Operating System: " + dockerInfo.getOperatingSystem() + "\n Total Memory: " + dockerInfo.getMemTotal() / (1024 * 1024) + " MB");
final Version version = versionCmd.exec(); builder = builder.withApiVersion(version.getApiVersion());
private ReportBuilder createDockerInfoGroup(DockerClientExecutor executor) { Version version = executor.dockerHostVersion(); final ReportBuilder reportBuilder = Reporter.createReport(DOCKER_HOST_INFORMATION) .addKeyValueEntry(DOCKER_VERSION, version.getVersion()) .addKeyValueEntry(DOCKER_OS, version.getOperatingSystem()) .addKeyValueEntry(DOCKER_KERNEL, version.getKernelVersion()) .addKeyValueEntry(DOCKER_API_VERSION, version.getApiVersion()) .addKeyValueEntry(DOCKER_ARCH, version.getArch()); return reportBuilder; }