diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/docker-util.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/docker-util.c index 8cd59f74040..5be02a97380 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/docker-util.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/utils/docker-util.c @@ -830,6 +830,7 @@ free_and_exit: int get_docker_start_command(const char *command_file, const struct configuration *conf, args *args) { int ret = 0; + char *docker = NULL; char *container_name = NULL; struct configuration command_config = {0, NULL}; ret = read_and_verify_command_file(command_file, DOCKER_START_COMMAND, &command_config); @@ -842,9 +843,18 @@ int get_docker_start_command(const char *command_file, const struct configuratio return INVALID_DOCKER_CONTAINER_NAME; } + docker = get_docker_binary(conf); + ret = add_to_args(args, docker); + free(docker); + if (ret != 0) { + ret = BUFFER_TOO_SMALL; + goto free_and_exit; + } + ret = add_docker_config_param(&command_config, args); if (ret != 0) { - return BUFFER_TOO_SMALL; + ret = BUFFER_TOO_SMALL; + goto free_and_exit; } ret = add_to_args(args, DOCKER_START_COMMAND); @@ -933,7 +943,7 @@ static int set_pid_namespace(const struct configuration *command_config, if (pid_host_enabled != NULL) { if (strcmp(pid_host_enabled, "1") == 0 || strcasecmp(pid_host_enabled, "True") == 0) { - ret = add_to_args(args, "--pid='host'"); + ret = add_to_args(args, "--pid=host"); if (ret != 0) { ret = BUFFER_TOO_SMALL; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/utils/test_docker_util.cc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/utils/test_docker_util.cc index 1096935e1cb..3746fa142d5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/utils/test_docker_util.cc +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/utils/test_docker_util.cc @@ -365,7 +365,7 @@ namespace ContainerExecutor { std::vector > file_cmd_vec; file_cmd_vec.push_back(std::make_pair( "[docker-command-execution]\n docker-command=start\n name=container_e1_12312_11111_02_000001", - "start container_e1_12312_11111_02_000001")); + "/usr/bin/docker start container_e1_12312_11111_02_000001")); std::vector > bad_file_cmd_vec; bad_file_cmd_vec.push_back(std::make_pair( @@ -514,7 +514,7 @@ namespace ContainerExecutor { std::vector >::const_iterator itr; std::vector >::const_iterator itr2; file_cmd_vec.push_back(std::make_pair( - "[docker-command-execution]\n docker-command=run\n pid=host", "--pid='host'")); + "[docker-command-execution]\n docker-command=run\n pid=host", "--pid=host")); file_cmd_vec.push_back(std::make_pair( "[docker-command-execution]\n docker-command=run", "")); bad_file_cmd_vec.push_back(std::make_pair(