void clean(final Id id) {
   if (id == null) {
     throw new IllegalArgumentException("id is null");
   }
   stop(id);
   logger.info("Cleaning " + id);
   for (Container container : findAllContainers(id)) {
     logger.info("Removing container " + container.getId());
     try {
       removeContainer(container);
     } catch (DockerException e) {
       throw new OrchestrationException(e);
     }
   }
   String imageId = null;
   try {
     imageId = findImageId(id);
   } catch (NotFoundException e) {
     logger.warn("Image " + id + " not found");
   } catch (DockerException e) {
     throw new OrchestrationException(e);
   }
   if (imageId != null) {
     logger.info("Removing image " + imageId);
     try {
       docker.removeImageCmd(imageId).withForce().exec();
     } catch (DockerException e) {
       logger.warn(e.getMessage());
     }
   }
 }
  private void start(final Id id) {
    if (id == null) {
      throw new IllegalArgumentException("id is null");
    }
    final Pattern waitForPattern = compileWaitForPattern(id);

    logger.info("Starting " + id);

    try {
      if (!imageExists(id)) {
        logger.info("Image does not exist, so building it");
        build(id);
      }
    } catch (DockerException e) {
      throw new OrchestrationException(e);
    }

    try {
      Container existingContainer = findContainer(id);

      if (existingContainer == null) {
        logger.info("No existing container so creating and starting new one");
        startContainer(createNewContainer(id));

      } else if (!isImageIdFromContainerMatchingProvidedImageId(existingContainer.getId(), id)) {
        logger.info("Image IDs do not match, removing container and creating new one from image");
        removeContainer(existingContainer);
        startContainer(createNewContainer(id));

      } else if (isRunning(id)) {
        logger.info("Container already running");

      } else {
        logger.info("Starting existing container " + existingContainer.getId());
        startContainer(existingContainer.getId());
      }

      try (Tail tail = tailFactory.newTail(docker, findContainer(id), logger)) {
        tail.start();

        for (Plugin plugin : plugins) {
          plugin.started(id, conf(id));
        }

        healthCheck(id);

        sleep(id);

        tail.setMaxLines(conf(id).getMaxLogLines());
      }
      waitFor(id, waitForPattern);
    } catch (DockerException e) {
      throw new OrchestrationException(e);
    }
  }