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;
}
Aggregations