/**
  * @return Configuration
  */
 public function build()
 {
     $servicesFormat = 'xml';
     $cachedContainer = $this->_baseDir . '/' . self::CACHED_CONTAINER;
     $configuration = Configuration::fromParameters($cachedContainer, $this->_collectConfigFolders(), !$this->_mageApp->useCache(self::MODEL_ALIAS), $servicesFormat);
     $configuration->setTestEnvironment($this->_isTestEnvironment());
     return $configuration;
 }
 /**
  * @Given I have configured different services in both :folder1 and :folder2
  */
 public function iHaveConfiguredServicesInBothAnd($folder1, $folder2)
 {
     $folder1 = 'features/' . $folder1;
     $folder2 = 'features/' . $folder2;
     $this->configuration = Configuration::fromParameters($this->cachedContainerFile, [$folder1, $folder2], true, 'xml');
 }
<?php

require_once 'vendor/autoload.php';
use ContainerTools\ContainerGenerator;
use ContainerTools\Configuration;
$configFolders = preg_split('/,/', $argv[1]);
$isDebug = $argv[2] == 'true';
$isTest = $argv[3] == 'true';
$config = Configuration::fromParameters('./container.cache.php', $configFolders, $isDebug, 'xml');
$config->setTestEnvironment($isTest);
$container = new ContainerGenerator($config);
$container->getContainer();
include_once 'container.cache.php';
$container = new ProjectServiceContainer();
file_put_contents('serialized.container', serialize($container->getServiceIds()));