diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerKeys.java index 40b73a2a90e..0e1d2884242 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerKeys.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerKeys.java @@ -26,6 +26,7 @@ public interface DockerKeys { String DOCKER_START_COMMAND = DOCKER_PREFIX + "startCommand"; String DEFAULT_DOCKER_NETWORK = "bridge"; + Boolean DEFAULT_DOCKER_USE_PRIVILEGED = false; String OUT_FILE = "stdout.txt"; String ERR_FILE = "stderr.txt"; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java index af36620a428..cc319eec3b0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/docker/DockerProviderService.java @@ -131,7 +131,7 @@ public class DockerProviderService extends AbstractProviderService implements launcher.setDockerNetwork(appConf.getComponentOpt(roleGroup, DOCKER_NETWORK, DEFAULT_DOCKER_NETWORK)); launcher.setRunPrivilegedContainer(appConf.getComponentOptBool(roleGroup, - DOCKER_USE_PRIVILEGED, false)); + DOCKER_USE_PRIVILEGED, DEFAULT_DOCKER_USE_PRIVILEGED)); // Set the environment Map standardTokens = providerUtils.getStandardTokenMap( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java index 49e7b785ccc..6db375d9a9f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java @@ -91,6 +91,9 @@ import java.util.concurrent.atomic.AtomicInteger; import static org.apache.slider.api.ResourceKeys.*; import static org.apache.slider.api.RoleKeys.*; import static org.apache.slider.api.StateValues.*; +import static org.apache.slider.providers.docker.DockerKeys.DEFAULT_DOCKER_USE_PRIVILEGED; +import static org.apache.slider.providers.docker.DockerKeys.DOCKER_IMAGE; +import static org.apache.slider.providers.docker.DockerKeys.DOCKER_USE_PRIVILEGED; /** * The model of all the ongoing state of a Slider AM. @@ -1823,6 +1826,15 @@ public class AppState { if (SliderUtils.isSet(prefix)) { cd.setRoleOpt(rolename, ROLE_PREFIX, SliderUtils.trimPrefix(prefix)); } + String dockerImage = instanceDefinition.getAppConfOperations() + .getComponentOpt(role.getGroup(), DOCKER_IMAGE, null); + if (SliderUtils.isSet(dockerImage)) { + cd.setRoleOpt(rolename, DOCKER_IMAGE, dockerImage); + Boolean dockerUsePrivileged = instanceDefinition.getAppConfOperations() + .getComponentOptBool(role.getGroup(), DOCKER_USE_PRIVILEGED, + DEFAULT_DOCKER_USE_PRIVILEGED); + cd.setRoleOpt(rolename, DOCKER_USE_PRIVILEGED, dockerUsePrivileged); + } List instances = instanceMap.get(rolename); int nodeCount = instances != null ? instances.size(): 0; cd.setRoleOpt(rolename, COMPONENT_INSTANCES,