Search in sources :

Example 1 with DockerRegistryCredentials

use of org.opentosca.toscana.plugins.kubernetes.docker.util.DockerRegistryCredentials in project TOSCAna by StuPro-TOSCAna.

the class PushingImageBuilderIT method init.

@Override
public void init() throws Exception {
    Assume.assumeTrue(DockerTestUtils.isDockerAvailable());
    this.credentials = new DockerRegistryCredentials("127.0.0.1:5000", "", "", "testing");
    DockerClient client = DefaultDockerClient.fromEnv().build();
    logger.info("Downloading registry image");
    client.pull("registry:2");
    final Map<String, List<PortBinding>> ports = singletonMap("5000/tcp", Collections.singletonList(PortBinding.of("0.0.0.0", 5000)));
    final HostConfig hostConfig = HostConfig.builder().portBindings(ports).build();
    logger.info("Creating Local Registry Container");
    ContainerConfig config = ContainerConfig.builder().hostConfig(hostConfig).image("registry:2").build();
    String id = client.createContainer(config).id();
    logger.info("Registry container id: {}", id);
    logger.info("Starting registry container");
    client.startContainer(id);
    this.registryId = id;
}
Also used : DockerRegistryCredentials(org.opentosca.toscana.plugins.kubernetes.docker.util.DockerRegistryCredentials) ContainerConfig(com.spotify.docker.client.messages.ContainerConfig) DockerClient(com.spotify.docker.client.DockerClient) DefaultDockerClient(com.spotify.docker.client.DefaultDockerClient) HostConfig(com.spotify.docker.client.messages.HostConfig) List(java.util.List)

Aggregations

DefaultDockerClient (com.spotify.docker.client.DefaultDockerClient)1 DockerClient (com.spotify.docker.client.DockerClient)1 ContainerConfig (com.spotify.docker.client.messages.ContainerConfig)1 HostConfig (com.spotify.docker.client.messages.HostConfig)1 List (java.util.List)1 DockerRegistryCredentials (org.opentosca.toscana.plugins.kubernetes.docker.util.DockerRegistryCredentials)1