EXecutes command to given container returning the inspection object as well. This method does 3 calls to
dockerhost. Create, Start and Inspect.

@param containerId
to execute command.
972528
public ExecInspection execStartVerbose(String containerId, String... commands) {
        this.readWriteLock.readLock().lock();
        try {
            String id = execCreate(containerId, commands);
            CubeOutput output = execStartOutput(id);

            return new ExecInspection(output, inspectExec(id));
        } finally {
            this.readWriteLock.readLock().unlock();
        }
    }
378954
protected function runForegroundProcess(Container $container)
    {
       $this->exitcode = (new Process($this->buildForegroundCommand(), base_path(), null, null, null))->run();
    }
862362
public Object executeService(ContainerWrapper cw) throws Exception {
		Debug.logVerbose("[JdonFramework]enter service execution core ", module);
		Object result = null;
		try {
			AopClient aopClient = (AopClient) cw.lookup(ComponentKeys.AOP_CLIENT);
			result = aopClient.invoke();
		} catch (Exception ex) {
			Debug.logError("[JdonFramework] execute the service error: " + ex, module);
			throw new Exception("execute service error: " + ex);
		} catch (Throwable ex) {
			Debug.logError("[JdonFramework]  execute Service error: " + ex, module);
			throw new Exception("  execute Service error: " + ex);
		}
		return result;
	}
408593
private CompletableFuture<Void> stopContainer(int containerId) {
        log.info("Stopping Container {}.", containerId);
        ContainerHandle handle = handles.get(containerId);
        if (handle == null) {
            log.warn("Container {} handle is null, container is pending start or already unregistered.", containerId);
            return null;
        } else {
            this.pendingTasks.add(containerId);
            try {
                return registry
                        .stopContainer(handle, CLOSE_TIMEOUT_PER_CONTAINER)
                        .whenComplete((aVoid, throwable) -> {
                            if (throwable != null) {
                                log.warn("Stopping container {} failed: {}", containerId, throwable);
                            }
                            try {
                                // We remove the handle and don't attempt retry on stop container failures.
                                unregisterHandle(containerId);
                            } finally {
                                // The pending task has to be removed after the handle is removed to avoid inconsistencies
                                // with the container state.
                                // Using finally block to ensure this is always called, otherwise this will prevent other
                                // tasks from being attempted for this container id.
                                this.pendingTasks.remove(containerId);
                            }
                        });
            } catch (Throwable e) {
                // The pending task has to be removed on all failures to enable retries.
                this.pendingTasks.remove(containerId);
                throw e;
            }
        }
    }
220340
function (id) {
		var container = this._container = L.DomUtil.get(id);

		if (!container) {
			throw new Error('Map container not found.');
		} else if (container._leaflet) {
			throw new Error('Map container is already initialized.');
		}

		container._leaflet = true;
	}
369791
def create_container(app_id,container_id,container_name):
    
    try:
        conn = get_conn()
        c = conn.cursor()
        c.execute("INSERT INTO container (id,name,app_id) VALUES ('{0}','{1}','{2}')"
            .format(container_id,container_name,app_id))
        conn.commit()
        conn.close()
        print 'create container %s succeed!' % app_id
    except Exception,e :
        raise RuntimeError('create container %s failed! %s' % (app_id,e))
4670
def handle(self, *args, **options):
        
        self._connection = Auth()._get_connection()

        if len(args) == 0:
            containers = self._connection.list_containers()
            if not containers:
                print("No containers were found for this account.")
        elif len(args) == 1:
            containers = self._connection.list_container_object_names(args[0])
            if not containers:
                print("No matching container found.")
        else:
            raise CommandError("Pass one and only one [container_name] as an argument")

        for container in containers:
            print(container)
941095
def container_running(self, id=None, name=None):
        
        running = False
        if id:
            running = self.inspect_container(id)['State']['Running']
        elif name:
            running = self.inspect_container(name)['State']['Running']
        return running
927131
static public function run(ContainerInterface $container)
    {
        $request = ServerRequestFactory::fromGlobals();
        $response = $container->get('HttpDispatcher')->dispatch($request);
        (new SapiEmitter())->emit($response);
    }
156297
public OvhContainerDetail project_serviceName_storage_containerId_GET(String serviceName, String containerId) throws IOException {
		String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
		StringBuilder sb = path(qPath, serviceName, containerId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhContainerDetail.class);
	}
1240183
public void execNoResponse(String id, String ... params) throws Exception {
		container.run(getCmd(id, params));
	}
617552
public function run(Container $container)
    {
        if ((! $this->ignoreMutex) && $this->description && $this->withoutOverlapping && (! $this->setMutex())) {
            return;
        }

        $this->runCommandInForeground($container);

        return $this->exitcode;
    }
1367241
public function containersExec($container, $execute_command) {
    $this->validateConfig();
    $this->title('Executing in container: ' . $container, FALSE);
    $this->taskDockerComposeExecute()
      ->file($this->dockerComposeFile)
      ->projectName($this->config->get('name'))
      ->disablePseudoTty()
      ->setContainer(' ' . $container)
      ->exec($execute_command)
      ->run();
  }
696744
public Object exec(String id, String ... params) throws PHPException {
		return container.getObjectParser().parse(getCmd(id, params));
	}
1373565
private function executeCreate(ContainerInterface $container, IoInterface $inOut): void
    {
        $argClass = static::ARG_CLASS;
        if ($inOut->hasArgument($argClass) === false) {
            $inOut->writeError("Argument `$argClass` is not provided." . PHP_EOL);

            return;
        }
        $class = $inOut->getArgument($argClass);

        $fileSystem     = $this->getFileSystem($container);
        $commandsFolder = $this->getCommandsFolder($container);
        if (empty($commandsFolder) === true || $fileSystem->isFolder($commandsFolder) === false) {
            $inOut->writeError(
                "Commands folder `$commandsFolder` is not valid. Check your `Application` settings." . PHP_EOL
            );

            return;
        }

        $classPath = $commandsFolder . DIRECTORY_SEPARATOR . $class . '.php';
        if (ctype_alpha($class) === false ||
            $fileSystem->exists($classPath) === true
        ) {
            $inOut->writeError(
                "Class name `$class` does not look valid for a command. " .
                'Can you please choose another one?' . PHP_EOL
            );

            return;
        }

        $replace = function (string $template, iterable $parameters): string {
            $result = $template;
            foreach ($parameters as $key => $value) {
                $result = str_replace($key, $value, $result);
            }

            return $result;
        };

        $templateContent = $fileSystem->read(__DIR__ . DIRECTORY_SEPARATOR . 'SampleCommand.txt');
        $fileSystem->write($classPath, $replace($templateContent, [
            '{CLASS_NAME}'   => $class,
            '{COMMAND_NAME}' => strtolower($class),
            '{TO_DO}'        => 'TODO',
        ]));
    }
122566
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $command = sprintf(
            'exec -i %s %s',
            $input->getArgument('container'),
            $input->getArgument('execcmd')
        );

        $response = $this->getFacade()->runDocker($command);

        if ($output->isVerbose()) {
            $output->writeln($response);
        }
    }
1101523
def runContainer(image, **kwargs):
    '''
    '''
    container = None
    try:
        container = client.containers.run(image, **kwargs)
        if "name" in kwargs.keys():
          print("Container", kwargs["name"], "is now running.")
    except ContainerError as exc:
        eprint("Failed to run container")
        raise exc
    except ImageNotFound as exc:
        eprint("Failed to find image to run as a docker container")
        raise exc
    except APIError as exc:
        eprint("Unhandled error")
        raise exc

    return container