@SuppressWarnings("deprecation")
    private void launchContainer(
            Map<String, LocalResource> containerLocalResource,
            Map<String, String> containerEnv,
            List<String> containerLaunchcommands,
            Container container,
            int index)
            throws IOException {
        LOG.info("Setting up launch context for containerid=" + container.getId());

        if (hboxAppType.equals("MPI") || hboxAppType.equals("TENSORNET") || hboxAppType.equals("HOROVOD")) {
            // mpiContainerCommand must be ready, and this openmpi generated orted command sould be splitted by spaces
            String containerMpiCommand = mpiContainerCommand.replace("<template>", String.valueOf(index));
            LOG.info("Container mpi command is: " + containerMpiCommand);
            containerLaunchcommands = new ArrayList(containerLaunchcommands);
            for (final String arg : containerMpiCommand.split("\\s+")) {
                // escape for bash -c "..arg.." in launch_container.sh
                containerLaunchcommands.add(ShellEscapeUtils.escapeContainerLaunch(arg));
            }
        }
        containerEnv.put(HboxConstants.Environment.HBOX_TF_INDEX.toString(), String.valueOf(index));

        // propagate opentelemetry context to containers
        HboxOpenTelemetry.injectIntoEnvMap(containerEnv);

        ContainerLaunchContext ctx = ContainerLaunchContext.newInstance(
                containerLocalResource, containerEnv, containerLaunchcommands, null, null, null);

        try {
            nmAsync.startContainerAsync(container, ctx);
        } catch (Exception e) {
            throw new RuntimeException("Launching container " + container.getId() + " failed!");
        }
    }
Async Method telling NMClientAsync to launch specific container

@param container the container which should be launched
@return is launched success
core/src/main/java/net/qihoo/hbox/AM/ApplicationMaster.java