PHP code example of softbricks / docker-wrapper

1. Go to this page and download the library: Download softbricks/docker-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

softbricks / docker-wrapper example snippets


$docker = new Docker();

if ($docker->isInstalled()) {

    if ($docker->isContainerExisting('my-container')) {

        if (!$docker->isContainerRunning('my-container')) {
            $docker->start('my-container');
        }

        $containerInfo = $docker->getContainerInfo('my-container');

        // .. do something with it

        $docker->stop('my-container');
    }
}