LinuxContainerExecutor extends ContainerExecutor { public void removeDockerContainer(String containerId) { try { PrivilegedOperationExecutor privOpExecutor = PrivilegedOperationExecutor.getInstance(super.getConf()); if (DockerCommandExecutor.isRemovable( DockerCommandExecutor.getContainerStatus(containerId, privOpExecutor, nmContext))) { LOG.info("Removing Docker container : " + containerId); DockerRmCommand dockerRmCommand = new DockerRmCommand(containerId, ResourceHandlerModule.getCgroupsRelativeRoot()); DockerCommandExecutor.executeDockerCommand(dockerRmCommand, containerId, null, privOpExecutor, false, nmContext); } } catch (ContainerExecutionException e) { LOG.warn("Unable to remove docker container: " + containerId); } } LinuxContainerExecutor();  LinuxContainerExecutor(LinuxContainerRuntime linuxContainerRuntime); @Override void setConf(Configuration conf); @Override void init(Context context); @Override void startLocalizer(LocalizerStartContext ctx); @VisibleForTesting void buildMainArgs(List<String> command, String user, String appId,
      String locId, InetSocketAddress nmAddr, List<String> localDirs); @Override void prepareContainer(ContainerPrepareContext ctx); @Override int launchContainer(ContainerStartContext ctx); @Override int relaunchContainer(ContainerStartContext ctx); @Override String[] getIpAndHost(Container container); @Override int reacquireContainer(ContainerReacquisitionContext ctx); @Override boolean signalContainer(ContainerSignalContext ctx); @Override boolean reapContainer(ContainerReapContext ctx); @Override void deleteAsUser(DeletionAsUserContext ctx); @Override void symLink(String target, String symlink); @Override boolean isContainerAlive(ContainerLivenessContext ctx); void mountCgroups(List<String> cgroupKVs, String hierarchy); @VisibleForTesting ResourceHandler getResourceHandler(); void removeDockerContainer(String containerId);  }
@Test public void testRemoveDockerContainer() throws Exception { ApplicationId appId = ApplicationId.newInstance(12345, 67890); ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 54321); String cid = ContainerId.newContainerId(attemptId, 9876).toString(); LinuxContainerExecutor lce = mock(LinuxContainerExecutor.class); lce.removeDockerContainer(cid); verify(lce, times(1)).removeDockerContainer(cid); }