You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/08/22 02:25:45 UTC

git commit: Allow multiple colons for docker image.

Repository: mesos
Updated Branches:
  refs/heads/master 9e68e980a -> b80482c07


Allow multiple colons for docker image.

Review: https://reviews.apache.org/r/24916


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b80482c0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b80482c0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b80482c0

Branch: refs/heads/master
Commit: b80482c07c8a9d354dc38d170bf41b038f52356e
Parents: 9e68e98
Author: Timothy Chen <tn...@apache.org>
Authored: Thu Aug 21 17:25:20 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 21 17:25:20 2014 -0700

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b80482c0/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index e3c29b8..0febbac 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -441,17 +441,15 @@ Future<Nothing> DockerContainerizerProcess::pull(
   argv.push_back(flags.docker);
   argv.push_back("pull");
 
-  vector<string> parts = strings::split(dockerInfo.image(), ":");
-
-  if (parts.size() > 2) {
-    return Failure("Not expecting multiple ':' in image: " +
-                   dockerInfo.image());
-  }
-
-  if (parts.size() == 2) {
+  // Check if the specified image has a tag. Also split on "/" in case
+  // the user specified a registry server (ie: localhost:5000/image)
+  // to get the actual image name. If no tag was given we add a
+  // 'latest' tag to avoid pulling down the repository.
+  vector<string> parts = strings::split(dockerInfo.image(), "/");
+  if (strings::contains(parts.back(), ":")) {
     argv.push_back(dockerInfo.image());
   } else {
-    argv.push_back(parts[0] + ":latest");
+    argv.push_back(dockerInfo.image() + ":latest");
   }
 
   VLOG(1) << "Running " << strings::join(" ", argv);