Package com.spotify.docker.client.messages

Examples of com.spotify.docker.client.messages.ContainerCreation


    // Create container
    final ContainerConfig containerConfig = config.containerConfig(imageInfo);
    final String name = config.containerName();
    listener.creating();
    final ContainerCreation container = docker.createContainer(containerConfig, name);
    log.info("created container: {}: {}, {}", config, container, containerConfig);
    listener.created(container.id());

    // Start container
    final HostConfig hostConfig = config.hostConfig();
    log.info("starting container: {}: {} {}", config, container.id(), hostConfig);
    listener.starting();
    docker.startContainer(container.id(), hostConfig);
    log.info("started container: {}: {}", config, container.id());
    listener.started();

    return container.id();
  }
View Full Code Here


    final ContainerConfig config = ContainerConfig.builder()
        .image(BUSYBOX)
        .cmd(IDLE_COMMAND)
        .build();
    final HostConfig hostConfig = HostConfig.builder().build();
    final ContainerCreation creation = docker.createContainer(config, name);
    final String containerId = creation.id();
    docker.startContainer(containerId, hostConfig);
  }
View Full Code Here

          .build();
      final HostConfig hostConfig = HostConfig.builder()
          .portBindings(ImmutableMap.of("4711/tcp",
                                        asList(PortBinding.of("0.0.0.0", probePort))))
          .build();
      final ContainerCreation creation = docker.createContainer(config, testTag + "-probe");
      final String containerId = creation.id();
      docker.startContainer(containerId, hostConfig);

      // Wait for container to come up
      Polling.await(5, SECONDS, new Callable<Object>() {
        @Override
View Full Code Here

  @Test
  public void verifySupervisorStartsAndStopsDockerContainer() throws Exception {
    final String containerId = "deadbeef";

    final ContainerCreation createResponse = new ContainerCreation(containerId);

    final SettableFuture<ContainerCreation> createFuture = SettableFuture.create();
    when(docker.createContainer(any(ContainerConfig.class),
                                any(String.class))).thenAnswer(futureAnswer(createFuture));
View Full Code Here

  @Test
  public void verifySupervisorRestartsExitedContainer() throws Exception {
    final String containerId1 = "deadbeef1";
    final String containerId2 = "deadbeef2";

    final ContainerCreation createResponse1 = new ContainerCreation(containerId1);
    final ContainerCreation createResponse2 = new ContainerCreation(containerId2);

    when(docker.createContainer(any(ContainerConfig.class), any(String.class)))
        .thenReturn(createResponse1);

    final ImageInfo imageInfo = new ImageInfo();
View Full Code Here

  @Test
  public void verifySupervisorStartsAndStopsDockerContainer() throws Exception {
    final String containerId = "deadbeef";

    final ContainerCreation createResponse = new ContainerCreation(containerId);

    final SettableFuture<ContainerCreation> createFuture = SettableFuture.create();
    when(docker.createContainer(any(ContainerConfig.class),
                                any(String.class))).thenAnswer(futureAnswer(createFuture));
View Full Code Here

TOP

Related Classes of com.spotify.docker.client.messages.ContainerCreation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.