Add docker hostname option.
Conflicts:
src/docker/docker.cpp
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ae38c530
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ae38c530
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ae38c530
Branch: refs/heads/master
Commit: ae38c53068b49b328ce40f3a17e2437b8dd747d7
Parents: 3f7a9cd
Author: Timothy Chen <[email protected]>
Authored: Fri Oct 17 12:54:50 2014 -0700
Committer: Timothy Chen <[email protected]>
Committed: Fri Oct 31 17:04:24 2014 -0700
----------------------------------------------------------------------
include/mesos/mesos.proto | 1 +
src/docker/docker.cpp | 9 +++++++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae38c530/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 572c74c..ef2ed52 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -894,6 +894,7 @@ message ContainerInfo {
required Type type = 1;
repeated Volume volumes = 2;
+ optional string hostname = 4;
optional DockerInfo docker = 3;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ae38c530/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 5b3a4de..0c0a1bf 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -368,6 +368,15 @@ Future<Nothing> Docker::run(
argv.push_back(network);
+ if (containerInfo.has_hostname()) {
+ if (network == "host") {
+ return Failure("Unable to set hostname with host network mode");
+ }
+
+ argv.push_back("--hostname");
+ argv.push_back(containerInfo.hostname());
+ }
+
foreach (const Parameter& parameter, dockerInfo.parameters()) {
argv.push_back("--" + parameter.key() + "=" + parameter.value());
}