RuncContainerRuntime extends OCIContainerRuntime { public Map<String, LocalResource> getLocalResources( Container container) throws IOException { Map<String, LocalResource> containerLocalRsrc = container.getLaunchContext().getLocalResources(); long layerCount = 0; Map<String, String> environment = container.getLaunchContext().getEnvironment(); String imageName = environment.get(ENV_RUNC_CONTAINER_IMAGE); if (imageName == null || imageName.isEmpty()) { environment.put(ENV_RUNC_CONTAINER_IMAGE, defaultRuncImage); imageName = defaultRuncImage; } ImageManifest manifest = imageTagToManifestPlugin.getManifestFromImageTag(imageName); LocalResource config = manifestToResourcesPlugin.getConfigResource(manifest); List<LocalResource> layers = manifestToResourcesPlugin.getLayerResources(manifest); RuncRuntimeObject runcRuntimeObject = new RuncRuntimeObject(config, layers); container.setContainerRuntimeData(runcRuntimeObject); for (LocalResource localRsrc : layers) { while(containerLocalRsrc.putIfAbsent("runc-layer" + Long.toString(layerCount), localRsrc) != null) { layerCount++; } } while(containerLocalRsrc.putIfAbsent("runc-config" + Long.toString(layerCount), config) != null) { layerCount++; } return containerLocalRsrc; } RuncContainerRuntime(PrivilegedOperationExecutor
      privilegedOperationExecutor); @VisibleForTesting  RuncContainerRuntime(PrivilegedOperationExecutor
      privilegedOperationExecutor, CGroupsHandler cGroupsHandler); @Override void initialize(Configuration configuration, Context nmCtx); @Override void start(); @Override void stop(); @Override void launchContainer(ContainerRuntimeContext ctx); Map<String, LocalResource> getLocalResources(
      Container container); String writeCommandToFile(
      RuncContainerExecutorConfig runcContainerExecutorConfig,
      Container container); String getExposedPorts(Container container); String[] getIpAndHost(Container container); IOStreamPair execContainer(ContainerExecContext ctx); void reapContainer(ContainerRuntimeContext ctx); void relaunchContainer(ContainerRuntimeContext ctx); static boolean isRuncContainerRequested(Configuration daemonConf,
      Map<String, String> env); @Override boolean isRuntimeRequested(Map<String, String> env); @Override void signalContainer(ContainerRuntimeContext ctx); @InterfaceAudience.Private
  static final String ENV_RUNC_CONTAINER_IMAGE; @InterfaceAudience.Private
  static final String ENV_RUNC_CONTAINER_MOUNTS; @InterfaceAudience.Private
  static final String ENV_RUNC_CONTAINER_HOSTNAME; @InterfaceAudience.Private
  final static String ENV_RUNC_CONTAINER_PID_NAMESPACE; @InterfaceAudience.Private
  final static String ENV_RUNC_CONTAINER_RUN_PRIVILEGED_CONTAINER; }
@Test public void testGetLocalResources() throws Exception { RuncContainerRuntime runtime = new MockRuncContainerRuntime( mockExecutor, mockCGroupsHandler); runtime.initialize(conf, nmContext); runtime.getLocalResources(container); RuncRuntimeObject runtimeObject = captureRuncRuntimeObject(1); LocalResource testConfig = runtimeObject.getConfig(); List<LocalResource> testLayers = runtimeObject.getOCILayers(); Assert.assertEquals(config, testConfig); Assert.assertEquals(layers, testLayers); }