com.spotify.docker.client.exceptions.ImageNotFoundException Java Examples

The following examples show how to use com.spotify.docker.client.exceptions.ImageNotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 6 votes vote down vote up
@Override
public List<RemovedImage> removeImage(String image, boolean force, boolean noPrune)
    throws DockerException, InterruptedException {
  try {
    final WebTarget resource = resource().path("images").path(image)
        .queryParam("force", String.valueOf(force))
        .queryParam("noprune", String.valueOf(noPrune));
    return request(DELETE, REMOVED_IMAGE_LIST, resource, resource.request(APPLICATION_JSON_TYPE));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(image, e);
      case 409:
        throw new ConflictException(e);
      default:
        throw e;
    }
  }
}
 
Example #2
Source File: RemoveImageMojoTest.java    From docker-maven-plugin with Apache License 2.0 6 votes vote down vote up
public void testRemoveImageWithTags() throws Exception {
  final File pom = getTestFile("src/test/resources/pom-removeMultipleImages.xml");
  assertNotNull("Null pom.xml", pom);
  assertTrue("pom.xml does not exist", pom.exists());

  final RemoveImageMojo mojo = (RemoveImageMojo) lookupMojo("removeImage", pom);
  assertNotNull(mojo);
  final DockerClient docker = mock(DockerClient.class);
  Mockito.when(docker.removeImage("imageToRemove", true, false))
      .thenThrow(new ImageNotFoundException("imageToRemove"));
  Mockito.when(docker.removeImage("imageToRemove:123456", true, false))
      .thenThrow(new ImageNotFoundException("imageToRemove:123456"));
  Mockito.when(docker.removeImage("imageToRemove:bbbbbbb", true, false))
      .thenReturn(new ArrayList<RemovedImage>());
  try {
    mojo.execute(docker);
  } catch (DockerException e){
    assertFalse("image to remove was missing", e instanceof ImageNotFoundException);
  }
  verify(docker).removeImage("imageToRemove:123456", true, false);
  verify(docker).removeImage("imageToRemove:bbbbbbb", true, false);
}
 
Example #3
Source File: RemoveImageMojoTest.java    From docker-maven-plugin with Apache License 2.0 6 votes vote down vote up
public void testRemoveMissingImage() throws Exception {
  final File pom = getTestFile("src/test/resources/pom-removeImage.xml");
  assertNotNull("Null pom.xml", pom);
  assertTrue("pom.xml does not exist", pom.exists());

  final RemoveImageMojo mojo = (RemoveImageMojo) lookupMojo("removeImage", pom);
  assertNotNull(mojo);
  final DockerClient docker = mock(DockerClient.class);
  Mockito.when(docker.removeImage("imageToRemove", true, false))
      .thenThrow(new ImageNotFoundException("imageToRemove"));
  try {
    mojo.execute(docker);
    verify(docker).removeImage("imageToRemove", true, false);
  } catch (DockerException e){
    assertFalse("image to remove was missing", e instanceof ImageNotFoundException);
  }
}
 
Example #4
Source File: TaskMonitor.java    From helios with Apache License 2.0 6 votes vote down vote up
@Override
public void failed(final Throwable th, String containerError) {
  if (th instanceof InterruptedException) {
    // Ignore failures due to interruptions as they're used when tearing down the agent and do
    // not indicate actual runner failures.
    return;
  }
  if (th instanceof ImageNotFoundException) {
    imageFailure(IMAGE_MISSING);
  } else if (th instanceof ImagePullFailedException) {
    imageFailure(IMAGE_PULL_FAILED);
  }
  // Don't use updateState() to avoid calling statusUpdater.update() twice in a row.
  statusUpdater.setState(FAILED);
  statusUpdater.setContainerError(containerError);
  // Commit and push a new status
  try {
    statusUpdater.update();
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
}
 
Example #5
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 6 votes vote down vote up
@Override
public List<ImageHistory> history(final String image)
    throws DockerException, InterruptedException {
  final WebTarget resource = resource()
      .path("images")
      .path(image)
      .path("history");
  try {
    return request(GET, IMAGE_HISTORY_LIST, resource, resource.request(APPLICATION_JSON_TYPE));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(image, e);
      default:
        throw e;
    }
  }
}
 
Example #6
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 6 votes vote down vote up
@Override
public void push(final String image,
                 final ProgressHandler handler,
                 final RegistryAuth registryAuth)
    throws DockerException, InterruptedException {
  final ImageRef imageRef = new ImageRef(image);

  WebTarget resource = resource().path("images").path(imageRef.getImage()).path("push");

  if (imageRef.getTag() != null) {
    resource = resource.queryParam("tag", imageRef.getTag());
  }

  try {
    requestAndTail(POST, handler, resource,
            resource.request(APPLICATION_JSON_TYPE)
                .header("X-Registry-Auth", authHeader(registryAuth)));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(image, e);
      default:
        throw e;
    }
  }
}
 
Example #7
Source File: DockerContainerTest.java    From docker-elastic-agents-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldPullAnImageWhenOneDoesNotExist() throws Exception {
    String imageName = "busybox:latest";

    try {
        docker.removeImage(imageName, true, false);
    } catch (ImageNotFoundException ignore) {
    }
    DockerContainer container = DockerContainer.create(new CreateAgentRequest("key", Collections.singletonMap("Image", imageName), "prod", jobIdentifier, Collections.EMPTY_MAP), createClusterProfiles(), docker, consoleLogAppender);
    containers.add(container.name());

    assertNotNull(docker.inspectImage(imageName));
    assertContainerExist(container.name());
}
 
Example #8
Source File: BuildMojo.java    From dockerfile-maven with Apache License 2.0 5 votes vote down vote up
private static boolean imageExistLocally(DockerClient dockerClient, String image)
        throws DockerException, InterruptedException {
  try {
    dockerClient.inspectImage(image);
    return true;
  } catch (ImageNotFoundException e) {
    return false;
  }
}
 
Example #9
Source File: HeliosSoloDeploymentTest.java    From helios with Apache License 2.0 5 votes vote down vote up
@Test
public void testDoesPullAbsentProbeImage() throws Exception {
  when(this.dockerClient.inspectImage(HeliosSoloDeployment.PROBE_IMAGE))
      .thenThrow(new ImageNotFoundException(HeliosSoloDeployment.PROBE_IMAGE));

  buildHeliosSoloDeployment();

  verify(this.dockerClient).pull(HeliosSoloDeployment.PROBE_IMAGE);
}
 
Example #10
Source File: HeliosSoloDeployment.java    From helios with Apache License 2.0 5 votes vote down vote up
private void pullIfAbsent(final String image) throws DockerException, InterruptedException {
  try {
    dockerClient.inspectImage(image);
    log.info("image {} is present. Not pulling it.", image);
    return;
  } catch (ImageNotFoundException e) {
    log.info("pulling new image: {}", image);
  }
  dockerClient.pull(image);
}
 
Example #11
Source File: TaskMonitorTest.java    From helios with Apache License 2.0 5 votes vote down vote up
@Test
public void verifyImageMissingTrumpsFlappingState() throws Exception {
  when(flapController.isFlapping()).thenReturn(true);
  sut.failed(new ImageNotFoundException("foobar", "not found"), "container error");
  verify(statusUpdater).setThrottleState(IMAGE_MISSING);
  verify(statusUpdater).setState(FAILED);
  verify(statusUpdater).setContainerError("container error");
  verify(statusUpdater).update();
}
 
Example #12
Source File: TaskMonitorTest.java    From helios with Apache License 2.0 5 votes vote down vote up
@Test
public void verifyMonitorPropagatesImageMissing() throws Exception {
  sut.failed(new ImageNotFoundException("foobar", "not found"), "container error");
  verify(statusUpdater).setThrottleState(IMAGE_MISSING);
  verify(statusUpdater).setState(FAILED);
  verify(statusUpdater).setContainerError("container error");
  verify(statusUpdater).update();
}
 
Example #13
Source File: TaskRunnerTest.java    From helios with Apache License 2.0 5 votes vote down vote up
@Test
public void testPullTimeoutVariation() throws Throwable {
  doThrow(new DockerTimeoutException("x", new URI("http://example.com"), null))
      .when(mockDocker).pull(IMAGE);

  doThrow(new ImageNotFoundException("not found"))
      .when(mockDocker).inspectImage(IMAGE);

  final TaskRunner tr = TaskRunner.builder()
      .delayMillis(0)
      .config(TaskConfig.builder()
          .namespace("test")
          .host(HOST)
          .job(JOB)
          .containerDecorators(ImmutableList.of(containerDecorator))
          .build())
      .docker(mockDocker)
      .listener(new TaskRunner.NopListener())
      .build();

  tr.run();

  try {
    tr.resultFuture().get();
    fail("this should throw");
  } catch (Exception t) {
    assertTrue(t instanceof ExecutionException);
    assertEquals(ImagePullFailedException.class, t.getCause().getClass());
  }
}
 
Example #14
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public ContainerCreation createContainer(final ContainerConfig config, final String name)
    throws DockerException, InterruptedException {
  WebTarget resource = resource()
      .path("containers").path("create");

  if (name != null) {
    checkArgument(CONTAINER_NAME_PATTERN.matcher(name).matches(),
                  "Invalid container name: \"%s\"", name);
    resource = resource.queryParam("name", name);
  }

  log.debug("Creating container with ContainerConfig: {}", config);

  try {
    return request(POST, ContainerCreation.class, resource, resource
        .request(APPLICATION_JSON_TYPE), Entity.json(config));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(config.image(), e);
      case 406:
        throw new DockerException("Impossible to attach. Container not running.", e);
      default:
        throw e;
    }
  }
}
 
Example #15
Source File: DockerContainerTest.java    From docker-elastic-agents-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRaiseExceptionWhenImageIsNotFoundInDockerRegistry() throws Exception {
    String imageName = "ubuntu:does-not-exist";
    thrown.expect(ImageNotFoundException.class);
    thrown.expectMessage(containsString("Image not found: " + imageName));
    DockerContainer.create(new CreateAgentRequest("key", Collections.singletonMap("Image", imageName), "prod", jobIdentifier, Collections.EMPTY_MAP), createClusterProfiles(), docker, consoleLogAppender);
}
 
Example #16
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public ImageInfo inspectImage(final String image) throws DockerException, InterruptedException {
  try {
    final WebTarget resource = resource().path("images").path(image).path("json");
    return request(GET, ImageInfo.class, resource, resource.request(APPLICATION_JSON_TYPE));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(image, e);
      default:
        throw e;
    }
  }
}
 
Example #17
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public void tag(final String image, final String name, final boolean force)
    throws DockerException, InterruptedException {
  final ImageRef imageRef = new ImageRef(name);

  WebTarget resource = resource().path("images").path(image).path("tag");

  resource = resource.queryParam("repo", imageRef.getImage());
  if (imageRef.getTag() != null) {
    resource = resource.queryParam("tag", imageRef.getTag());
  }

  if (force) {
    resource = resource.queryParam("force", true);
  }

  try {
    request(POST, resource, resource.request());
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 400:
        throw new BadParamException(getQueryParamMap(resource), e);
      case 404:
        throw new ImageNotFoundException(image, e);
      case 409:
        throw new ConflictException(e);
      default:
        throw e;
    }
  }
}
 
Example #18
Source File: LoggingPullHandler.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public void progress(ProgressMessage message) throws DockerException {
  if (message.error() != null) {
    if (message.error().contains("404") || message.error().contains("not found")) {
      throw new ImageNotFoundException(image, message.toString());
    } else {
      throw new ImagePullFailedException(image, message.toString());
    }
  }

  log.info("pull {}: {}", image, message);
}
 
Example #19
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public void pull(final String image, final RegistryAuth registryAuth,
                 final ProgressHandler handler)
    throws DockerException, InterruptedException {
  final ImageRef imageRef = new ImageRef(image);

  WebTarget resource = resource().path("images").path("create");

  resource = resource.queryParam("fromImage", imageRef.getImage());
  if (imageRef.getTag() != null) {
    resource = resource.queryParam("tag", imageRef.getTag());
  }

  try {
    requestAndTail(POST, handler, resource,
            resource
                .request(APPLICATION_JSON_TYPE)
                .header("X-Registry-Auth", authHeader(registryAuth)));
  } catch (DockerRequestException e) {
    switch (e.status()) {
      case 404:
        throw new ImageNotFoundException(image, e);
      default:
        throw e;
    }
  }
}
 
Example #20
Source File: GCloudEmulatorManager.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void launchDocker() throws DockerException, InterruptedException, DockerCertificateException {
	// Create a client based on DOCKER_HOST and DOCKER_CERT_PATH env vars
	docker = DefaultDockerClient.fromEnv().build();

	terminateAndDiscardAnyExistingContainers(true);

	LOG.info("");
	LOG.info("/===========================================");
	LOG.info("| GCloud Emulator");

	ContainerInfo containerInfo;
	String id;

	try {
		docker.inspectImage(DOCKER_IMAGE_NAME);
	} catch (ImageNotFoundException e) {
		// No such image so we must download it first.
		LOG.info("| - Getting docker image \"{}\"", DOCKER_IMAGE_NAME);
		docker.pull(DOCKER_IMAGE_NAME, message -> {
			if (message.id() != null && message.progress() != null) {
				LOG.info("| - Downloading > {} : {}", message.id(), message.progress());
			}
		});
	}

	// No such container. Good, we create one!
	LOG.info("| - Creating new container");

	// Bind container ports to host ports
	final Map<String, List<PortBinding>> portBindings = new HashMap<>();
	portBindings.put(INTERNAL_PUBSUB_PORT, Collections.singletonList(PortBinding.randomPort("0.0.0.0")));

	final HostConfig hostConfig = HostConfig.builder().portBindings(portBindings).build();

	// Create new container with exposed ports
	final ContainerConfig containerConfig = ContainerConfig.builder()
		.hostConfig(hostConfig)
		.exposedPorts(INTERNAL_PUBSUB_PORT)
		.image(DOCKER_IMAGE_NAME)
		.cmd("sh", "-c", "mkdir -p /opt/data/pubsub ; gcloud beta emulators pubsub start --data-dir=/opt/data/pubsub --host-port=0.0.0.0:" + INTERNAL_PUBSUB_PORT)
		.build();

	final ContainerCreation creation = docker.createContainer(containerConfig, CONTAINER_NAME_JUNIT);
	id = creation.id();

	containerInfo = docker.inspectContainer(id);

	if (!containerInfo.state().running()) {
		LOG.warn("| - Starting it up ....");
		docker.startContainer(id);
		Thread.sleep(1000);
	}

	containerInfo = docker.inspectContainer(id);

	dockerIpAddress = "127.0.0.1";

	Map<String, List<PortBinding>> ports = containerInfo.networkSettings().ports();

	assertNotNull("Unable to retrieve the ports where to connect to the emulators", ports);
	assertEquals("We expect 1 port to be mapped", 1, ports.size());

	pubsubPort = getPort(ports, INTERNAL_PUBSUB_PORT, "PubSub");

	LOG.info("| Waiting for the emulators to be running");

	// PubSub exposes an "Ok" at the root url when running.
	if (!waitForOkStatus("PubSub", pubsubPort)) {
		// Oops, we did not get an "Ok" within 10 seconds
		startHasFailedKillEverything();
	}
	LOG.info("\\===========================================");
	LOG.info("");
}
 
Example #21
Source File: GCloudEmulatorManager.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void launchDocker() throws DockerException, InterruptedException, DockerCertificateException {
	// Create a client based on DOCKER_HOST and DOCKER_CERT_PATH env vars
	docker = DefaultDockerClient.fromEnv().build();

	terminateAndDiscardAnyExistingContainers(true);

	LOG.info("");
	LOG.info("/===========================================");
	LOG.info("| GCloud Emulator");

	ContainerInfo containerInfo;
	String id;

	try {
		docker.inspectImage(DOCKER_IMAGE_NAME);
	} catch (ImageNotFoundException e) {
		// No such image so we must download it first.
		LOG.info("| - Getting docker image \"{}\"", DOCKER_IMAGE_NAME);
		docker.pull(DOCKER_IMAGE_NAME, message -> {
			if (message.id() != null && message.progress() != null) {
				LOG.info("| - Downloading > {} : {}", message.id(), message.progress());
			}
		});
	}

	// No such container. Good, we create one!
	LOG.info("| - Creating new container");

	// Bind container ports to host ports
	final Map<String, List<PortBinding>> portBindings = new HashMap<>();
	portBindings.put(INTERNAL_PUBSUB_PORT, Collections.singletonList(PortBinding.randomPort("0.0.0.0")));

	final HostConfig hostConfig = HostConfig.builder().portBindings(portBindings).build();

	// Create new container with exposed ports
	final ContainerConfig containerConfig = ContainerConfig.builder()
		.hostConfig(hostConfig)
		.exposedPorts(INTERNAL_PUBSUB_PORT)
		.image(DOCKER_IMAGE_NAME)
		.cmd("sh", "-c", "mkdir -p /opt/data/pubsub ; gcloud beta emulators pubsub start --data-dir=/opt/data/pubsub  --host-port=0.0.0.0:" + INTERNAL_PUBSUB_PORT)
		.build();

	final ContainerCreation creation = docker.createContainer(containerConfig, CONTAINER_NAME_JUNIT);
	id = creation.id();

	containerInfo = docker.inspectContainer(id);

	if (!containerInfo.state().running()) {
		LOG.warn("| - Starting it up ....");
		docker.startContainer(id);
		Thread.sleep(1000);
	}

	containerInfo = docker.inspectContainer(id);

	dockerIpAddress = "127.0.0.1";

	Map<String, List<PortBinding>> ports = containerInfo.networkSettings().ports();

	assertNotNull("Unable to retrieve the ports where to connect to the emulators", ports);
	assertEquals("We expect 1 port to be mapped", 1, ports.size());

	pubsubPort = getPort(ports, INTERNAL_PUBSUB_PORT, "PubSub");

	LOG.info("| Waiting for the emulators to be running");

	// PubSub exposes an "Ok" at the root url when running.
	if (!waitForOkStatus("PubSub", pubsubPort)) {
		// Oops, we did not get an "Ok" within 10 seconds
		startHasFailedKillEverything();
	}
	LOG.info("\\===========================================");
	LOG.info("");
}
 
Example #22
Source File: RemoveImageMojo.java    From docker-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected void execute(final DockerClient docker)
    throws MojoExecutionException, DockerException, InterruptedException {
  final String[] imageNameParts = parseImageName(imageName);
  if (imageTags == null) {
    imageTags = new ArrayList<>(1);
    imageTags.add(imageNameParts[1]);
  } else if (removeAllTags) {
    getLog().info("Removal of all tags requested, searching for tags");
    // removal of all tags requested, loop over all images to find tags
    for (final Image currImage : docker.listImages()) {
      getLog().debug("Found image: " + currImage.toString());
      String[] parsedRepoTag;
      if (currImage.repoTags() != null) {
        for (final String repoTag : currImage.repoTags()) {
          parsedRepoTag = parseImageName(repoTag);
          // if repo name matches imageName then save the tag for deletion
          if (Objects.equal(parsedRepoTag[0], imageNameParts[0])) {
            imageTags.add(parsedRepoTag[1]);
            getLog().info("Adding tag for removal: " + parsedRepoTag[1]);
          }
        }
      }
    }
  }
  imageTags.add(imageNameParts[1]);

  final Set<String> uniqueImageTags = new HashSet<>(imageTags);
  for (final String imageTag : uniqueImageTags) {
    final String currImageName =
        imageNameParts[0] + ((isNullOrEmpty(imageTag)) ? "" : (":" + imageTag));
    getLog().info("Removing -f " + currImageName);

    try {
      // force the image to be removed but don't remove untagged parents
      for (final RemovedImage removedImage : docker.removeImage(currImageName, true, false)) {
        getLog().info("Removed: " + removedImage.imageId());
      }
    } catch (ImageNotFoundException | NotFoundException e) {
      // ignoring 404 errors only
      getLog().warn("Image " + imageName + " doesn't exist and cannot be deleted - ignoring");
    }
  }
}
 
Example #23
Source File: DockerContainer.java    From docker-elastic-agents-plugin with Apache License 2.0 4 votes vote down vote up
public static DockerContainer create(CreateAgentRequest request, PluginSettings settings, DockerClient docker,
                                     ConsoleLogAppender consoleLogAppender) throws InterruptedException, DockerException {
    String containerName = UUID.randomUUID().toString();

    HashMap<String, String> labels = labelsFrom(request);
    String imageName = image(request.properties());
    List<String> env = environmentFrom(request, settings, containerName);

    try {
        docker.inspectImage(imageName);
        if (settings.pullOnContainerCreate()) {
            consoleLogAppender.accept("Pulling a fresh version of " + imageName + ".");
            LOG.info("Pulling a fresh version of " + imageName + ".");
            docker.pull(imageName);
        }
    } catch (ImageNotFoundException ex) {
        consoleLogAppender.accept("Image " + imageName + " not found, attempting to download.");
        LOG.info("Image " + imageName + " not found, attempting to download.");
        docker.pull(imageName);
    }

    ContainerConfig.Builder containerConfigBuilder = ContainerConfig.builder();
    if (StringUtils.isNotBlank(request.properties().get("Command"))) {
        containerConfigBuilder.cmd(splitIntoLinesAndTrimSpaces(request.properties().get("Command")).toArray(new String[]{}));
    }

    final String hostConfig = request.properties().get("Hosts");
    final String reservedMemory = request.properties().get("ReservedMemory");
    final String maxMemory = request.properties().get("MaxMemory");
    final String cpus = request.properties().get("Cpus");
    final String volumeMounts = request.properties().get("Mounts");

    HostConfig.Builder hostBuilder = HostConfig.builder()
            .privileged(privileged(request.properties()))
            .extraHosts(new Hosts(hostConfig))
            .memoryReservation(new MemorySpecification(reservedMemory).getMemory())
            .memory(new MemorySpecification(maxMemory).getMemory());

    CpusSpecification cpusValue = new CpusSpecification(cpus);
    if (cpusValue.getCpus() != null) {
        hostBuilder
                .cpuPeriod(cpusValue.getCpuPeriod())
                .cpuQuota(cpusValue.getCpuQuota());
    }
    if (volumeMounts != null) {
        hostBuilder.appendBinds(Util.splitIntoLinesAndTrimSpaces(volumeMounts));
    }

    ContainerConfig containerConfig = containerConfigBuilder
            .image(imageName)
            .labels(labels)
            .env(env)
            .hostConfig(hostBuilder.build())
            .build();

    consoleLogAppender.accept(String.format("Creating container: %s", containerName));
    ContainerCreation container = docker.createContainer(containerConfig, containerName);
    String id = container.id();

    ContainerInfo containerInfo = docker.inspectContainer(id);

    LOG.debug("Created container " + containerName);
    consoleLogAppender.accept(String.format("Starting container: %s", containerName));
    docker.startContainer(containerName);
    consoleLogAppender.accept(String.format("Started container: %s", containerName));
    LOG.debug("container " + containerName + " started");
    return new DockerContainer(id, containerName, request.jobIdentifier(), containerInfo.created(), request.properties(), request.environment());
}