/**
  * Creates a new DockerManager instance.
  *
  * @param string $dockerMachine
  *      (Optional) The name of the docker machine.
  */
 public function __construct($dockerMachine = 'default')
 {
     // TODO: Ensure windows compatibility.
     // Make sure the machine is started.
     $this->startMachine($dockerMachine);
     $this->environmentVariables = ['DOCKER_MACHINE_NAME' => $dockerMachine, 'DOCKER_TLS_VERIFY' => 1, 'DOCKER_HOST' => 'tcp://' . $this->dockerMachineIpAddress . ':' . self::DOCKER_MACHINE_PORT, 'DOCKER_CERT_PATH' => $_SERVER['HOME'] . '/.docker/machine/machines/default', 'HOME' => Application::getUserHomePath()];
     $this->localProjectPath = Application::getUserHomePath() . Application::LOCAL_PROJECT_PATH;
     $this->dispatcher = Application::getEventDispatcher();
 }
<?php

/**
 * @file
 * Contains container.php.
 */
use commpress\Cli\Application;
use commpress\Cli\Service\Database\Database;
use commpress\Cli\Service\Database\Exception\DatabaseNotFoundException;
use Symfony\Component\Filesystem\Filesystem;
$c = new \commpress\Cli\Service\DependencyInjection\DependencyInjectionContainer();
$c->addService('database', function () {
    $database = null;
    try {
        $envMgrPath = Application::getUserHomePath() . '/' . Application::ENVMGR_DIRECTORY;
        // Install the database file if not existing.
        $fs = new Filesystem();
        $fs->copy(Application::ROOT_DIR . '/app/resources/envmgr.db', $envMgrPath . '/envmgr.db');
        // Try to connect to the database.
        $database = new Database($envMgrPath . '/envmgr.db');
    } catch (DatabaseNotFoundException $e) {
        print sprintf('Error: %s' . "\n", $e->getMessage());
        exit;
    } catch (Exception $e) {
        print 'An unknown exception occured while trying to load the database.' . "\n";
        exit;
    }
    return $database;
});
$c->addService('docker', function () {
    return new \commpress\Cli\Service\Docker\DockerManager();