code: public Supervisor create(final Job job, final String existingContainerId,
                             final Map<String, Integer> ports,
                             final Supervisor.Listener listener) {
      final RestartPolicy policy = RestartPolicy.newBuilder().build();
      final TaskConfig taskConfig = TaskConfig.builder()
          .host(host)
          .job(job)
          .ports(ports)
          .envVars(envVars)
          .containerDecorators(containerDecorators)
          .namespace(namespace)
          .defaultRegistrationDomain(defaultRegistrationDomain)
          .dns(dns)
          .build();
  
      final TaskStatus.Builder taskStatus = TaskStatus.newBuilder()
          .setJob(job)
          .setEnv(taskConfig.containerEnv())
          .setPorts(taskConfig.ports());
      final StatusUpdater statusUpdater = new DefaultStatusUpdater(model, taskStatus);
      final FlapController flapController = FlapController.create();
      final TaskMonitor taskMonitor = new TaskMonitor(job.getId(), flapController, statusUpdater);
  
      final HealthChecker healthChecker = HealthCheckerFactory.create(
          taskConfig, dockerClient, dockerHost, agentRunningInContainer);
  
      final TaskRunnerFactory runnerFactory = TaskRunnerFactory.builder()
          .config(taskConfig)
          .registrar(registrar)
          .dockerClient(dockerClient)
          .healthChecker(healthChecker)
          .listener(taskMonitor)
          .build();
  
      return Supervisor.newBuilder()
          .setJob(job)
          .setExistingContainerId(existingContainerId)
          .setDockerClient(dockerClient)
          .setRestartPolicy(policy)
          .setMetrics(metrics)
          .setListener(listener)
          .setRunnerFactory(runnerFactory)
          .setStatusUpdater(statusUpdater)
          .setMonitor(taskMonitor)
          .build();
    }
docs: Create a new application container.
  
  @param job                 The job definition.
  @param existingContainerId ID of existing container.
  @param ports               The ports.
  @param listener            The listener.
  
  @return A new container.