1. Go to this page and download the library: Download larevio/docker-php-api 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/ */
larevio / docker-php-api example snippets
$docker = new \Larevio\DockerApi\Docker("http://localhost:2375", [], false);
$docker = new \Larevio\DockerApi\Docker("/var/run/docker.sock", [], false)
er = new \Larevio\DockerApi\Docker("http://localhost:2375", [], false);
$testContainer = $docker->createContainer("TestContainer", "helloworld");
$testContainer->start();
$alreadyExistContainer = $docker->container("XXX");
$customNetwork = $docker->createNetwork("test");
$alreadyExistContainer->connectToNetwork($customNetwork);
$alreadyExistContainer->setMemoryLimit(50000);
return [
'url' => "http://localhost:2222",
// Custom guzzlehttp options (headers, timeout, etc.)
// read more on https://docs.guzzlephp.org/en/stable/request-options.html
'options' => [
'auth' => ["test", "test"]
],
'async' => true // Should all requests be async ?
];