You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by tn...@apache.org on 2014/10/29 00:56:18 UTC
[6/8] git commit: Add docker hostname option.
Add docker hostname option.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/196ad015
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/196ad015
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/196ad015
Branch: refs/heads/docker_symlink
Commit: 196ad015c5ba3dcc680bdcebd40a3e646e393ed9
Parents: 7504664
Author: Timothy Chen <tn...@apache.org>
Authored: Fri Oct 17 12:54:50 2014 -0700
Committer: Timothy Chen <tn...@apache.org>
Committed: Tue Oct 28 16:50:18 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/196ad015/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 07dc8fe..73bc1b3 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -891,6 +891,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/196ad015/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index a9dacd4..693afd8 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());
+ }
+
if (dockerInfo.lxc_configs().size() > 0) {
if (network != "none") {
return Failure("Network mode has to be 'NONE' to support lxc configs");