Info dockerInfo = client.infoCmd().exec(); Version version = client.versionCmd().exec(); activeApiVersion = version.getApiVersion(); activeExecutionDriver = dockerInfo.getExecutionDriver(); log.info("Connected to docker: \n" + checkDockerVersion(version.getVersion());
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; }
public VersionAssert hasVersion(String version) { isNotNull(); if (!Objects.areEqual(this.actual.getVersion(), version)) { failWithMessage("Expected docker's version to be %s but was %s", version, this.actual.getVersion()); } return this; } }
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 boolean isTriton() { if( _isTriton == null ) { final Version remoteVersion; try(final DockerClient client = dockerApi.getClient()) { remoteVersion = client.versionCmd().exec(); } catch (IOException ex) { throw new RuntimeException(ex); } _isTriton = remoteVersion.getOperatingSystem().equals("solaris"); } return _isTriton; }
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); }
public boolean isSwarm() { if (_isSwarm == null) { try(final DockerClient client = getClient()) { Version remoteVersion = client.versionCmd().exec(); // Cache the return. _isSwarm = remoteVersion.getVersion().startsWith("swarm"); } catch (IOException ex) { throw new RuntimeException(ex); } } return _isSwarm; }
final Version version = versionCmd.exec(); builder = builder.withApiVersion(version.getApiVersion());
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()); } } }
@Override public final void execute() throws MojoExecutionException, MojoFailureException { MavenLogAppender.setLog(getLog()); if (skip) { getLog().info("skipped"); return; } // not great eh final Properties properties = properties(); getLog().debug("properties filtering supported for " + properties.keySet()); try { final DockerClient docker = dockerClient(); getLog().info("Docker version " + docker.versionCmd().exec().getVersion()); doExecute(dockerOrchestrator(properties, docker)); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException(e.getMessage(), e); } }
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"); checkDockerVersion(version.getVersion()); boolean checksEnabled = !TestcontainersConfiguration.getInstance().isDisableChecks(); if (checksEnabled) {