Fixed uncorrect launcher dir in docker executor.
Review: https://reviews.apache.org/r/39386
diff --git a/docs/configuration.md b/docs/configuration.md
index a98a909..287cdbd 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1173,7 +1173,9 @@
--launcher_dir=VALUE
</td>
<td>
- Directory path of Mesos binaries (default: /usr/local/lib/mesos)
+ Directory path of Mesos binaries. Mesos would find health-check, fetcher,
+ containerizer and executor binary files under this directory.
+ (default: /usr/local/libexec/mesos)
</td>
</tr>
<tr>
diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp
index 2a6452c..f5d206c 100644
--- a/src/docker/executor.cpp
+++ b/src/docker/executor.cpp
@@ -554,6 +554,11 @@
return EXIT_FAILURE;
}
+ if (flags.launcher_dir.isNone()) {
+ cerr << flags.usage("Missing required option --launcher_dir") << endl;
+ return EXIT_FAILURE;
+ }
+
// The 2nd argument for docker create is set to false so we skip
// validation when creating a docker abstraction, as the slave
// should have already validated docker.
@@ -563,18 +568,13 @@
return EXIT_FAILURE;
}
- const Option<string> envPath = os::getenv("MESOS_LAUNCHER_DIR");
- string path =
- envPath.isSome() ? envPath.get()
- : os::realpath(Path(argv[0]).dirname()).get();
-
mesos::internal::docker::DockerExecutor executor(
process::Owned<Docker>(docker.get()),
flags.container.get(),
flags.sandbox_directory.get(),
flags.mapped_directory.get(),
flags.stop_timeout.get(),
- path);
+ flags.launcher_dir.get());
mesos::MesosExecutorDriver driver(&executor);
return driver.run() == mesos::DRIVER_STOPPED ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/docker/executor.hpp b/src/docker/executor.hpp
index fa13b6e..c5b2374 100644
--- a/src/docker/executor.hpp
+++ b/src/docker/executor.hpp
@@ -53,6 +53,12 @@
"stop_timeout",
"The duration for docker to wait after stopping a running container\n"
"before it kills that container.");
+
+ add(&launcher_dir,
+ "launcher_dir",
+ "Directory path of Mesos binaries. Mesos would find health-check,\n"
+ "fetcher, containerizer and executor binary files under this\n"
+ "directory.");
}
Option<std::string> container;
@@ -60,6 +66,7 @@
Option<std::string> sandbox_directory;
Option<std::string> mapped_directory;
Option<Duration> stop_timeout;
+ Option<std::string> launcher_dir;
};
} // namespace docker {
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 1db276f..21c3ab1 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -177,6 +177,7 @@
dockerFlags.sandbox_directory = directory;
dockerFlags.mapped_directory = flags.sandbox_directory;
dockerFlags.stop_timeout = flags.docker_stop_timeout;
+ dockerFlags.launcher_dir = flags.launcher_dir;
return dockerFlags;
}
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index b36710d..7dd20e9 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -108,7 +108,9 @@
add(&Flags::launcher_dir, // TODO(benh): This needs a better name.
"launcher_dir",
- "Directory path of Mesos binaries",
+ "Directory path of Mesos binaries. Mesos would find health-check,\n"
+ "fetcher, containerizer and executor binary files under this\n"
+ "directory.",
PKGLIBEXECDIR);
add(&Flags::hadoop_home,