use of com.spotify.docker.client.DockerClient in project TOSCAna by StuPro-TOSCAna.
the class PushingImageBuilderIT method validate.
@Override
public void validate(String tag) throws Exception {
RegistryAuth auth = credentials.toRegistryAuth();
DockerClient client = DefaultDockerClient.fromEnv().registryAuthSupplier(new FixedRegistryAuthSupplier(auth, RegistryConfigs.create(Collections.singletonMap(credentials.getRegistryURL(), auth)))).build();
client.removeImage(tag);
// Pull the image from the registry
client.pull(tag);
}
use of com.spotify.docker.client.DockerClient in project TOSCAna by StuPro-TOSCAna.
the class KubernetesPushingGopherIT method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
DockerClient client = DefaultDockerClient.fromEnv().build();
logger.info("Downloading registry image");
client.pull("registry:2");
this.registryPort = 5000;
final Map<String, List<PortBinding>> ports = singletonMap("5000/tcp", Collections.singletonList(PortBinding.of("0.0.0.0", this.registryPort)));
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.runningContainers.add(id);
}
use of com.spotify.docker.client.DockerClient in project TOSCAna by StuPro-TOSCAna.
the class ImageBuilder method buildImage.
/**
* This Command Builds the DockerImage using the Dockerfile in the (previously specified) dockerWorkDir
*
* @throws Exception gets thrown if something during the Build Procedure fails
*/
public void buildImage() throws Exception {
DockerClient client = getDockerClient();
Path abs = Paths.get(access.getAbsolutePath(dockerWorkDir));
// Build the image
String result = client.build(abs, getTag(), this);
logger.info("Image build was successful. Image ID: {}", result);
}
use of com.spotify.docker.client.DockerClient in project TOSCAna by StuPro-TOSCAna.
the class PushingImageBuilder method storeImage.
@Override
public void storeImage() throws Exception {
DockerClient client = getDockerClient();
client.push(getTag(), this);
}
use of com.spotify.docker.client.DockerClient in project elastest-torm by elastest.
the class DockerService method stopDockerContainer.
public void stopDockerContainer(String containerId) throws Exception {
DockerClient dockerClient = getDockerClient();
this.stopDockerContainer(dockerClient, containerId);
}
Aggregations