From 527fe3b0b77e730c249521dac8eaf43430a76cd4 Mon Sep 17 00:00:00 2001 From: Florian Grundig Date: Wed, 5 Aug 2015 12:07:19 +0200 Subject: [PATCH] MesosCluster provides injectImage method which supports image tags. --- .../java/org/apache/mesos/mini/MesosCluster.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/mesos/mini/MesosCluster.java b/src/main/java/org/apache/mesos/mini/MesosCluster.java index b8ee1b6f..0db961e3 100644 --- a/src/main/java/org/apache/mesos/mini/MesosCluster.java +++ b/src/main/java/org/apache/mesos/mini/MesosCluster.java @@ -103,15 +103,26 @@ public String addAndStartContainer(AbstractContainer container) { return container.getContainerId(); } + /** + * Inject an image (with tag "latest") from your local docker daemon into the mesos cluster. + * + * @param imageName The name of the image (without tag) you want to push (in the format domain/image) + * @throws DockerException when an error pulling or pushing occurs. + */ + public void injectImage(String imageName) throws DockerException { + injectImage(imageName,"latest"); + } + /** * Inject an image from your local docker daemon into the mesos cluster. * * @param imageName The name of the image you want to push (in the format domain/image) + * @param tag The tag of image to inject (e.g. "1.0.0" or "latest") * @throws DockerException when an error pulling or pushing occurs. */ - public void injectImage(String imageName) throws DockerException { + public void injectImage(String imageName, String tag) throws DockerException { ImagePusher imagePusher = new ImagePusher(config.dockerClient, "localhost" + ":" + config.privateRegistryPort, getMesosContainer().getContainerId()); - imagePusher.injectImage(imageName); + imagePusher.injectImage(imageName, tag); } public State getStateInfo() throws UnirestException {