PHP code example of acamposm / docker-engine-api-poller
1. Go to this page and download the library: Download acamposm/docker-engine-api-poller 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/ */
acamposm / docker-engine-api-poller example snippets
use Acamposm\DockerEngineApiPoller\DockerServer;
$server = (new DockerServer())->server('localhost');
use Acamposm\DockerEngineApiPoller\DockerServer;
$server = (new DockerServer())->insecure()->port(12375)->server('localhost');
use Acamposm\DockerEngineApiPoller\DockerServer;
$server = (new DockerServer())->secure()->server('localhost');
use Acamposm\DockerEngineApiPoller\DockerServer;
$server = (new DockerServer())->secure()->port(12375)->server('localhost');
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$containers_list = (new DockerApiRequest($server))
->containers(ResourceMethods::CONTAINERS_LIST)
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$container_details = (new DockerApiRequest($server))
->containers(ResourceMethods::CONTAINERS_INSPECT, 'container_name')
->get();
use Acamposm\DockerEngineApiPoller\ContainerMetrics;
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$container_stats = (new DockerApiRequest($server))
->containers(ResourceMethods::CONTAINERS_STATS, 'container_name')
->get();
$metrics = (new ContainerMetrics($container_stats))->metrics();
var_dump($metrics);
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$images = (new DockerApiRequest($server))
->images(ResourceMethods::IMAGES_LIST)
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$image_details = (new DockerApiRequest($server))
->images(ResourceMethods::IMAGES_INSPECT, 'image_name')
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$networks = (new DockerApiRequest($server))
->networks(ResourceMethods::NETWORKS_LIST)
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$network_details = (new DockerApiRequest($server))
->networks(ResourceMethods::NETWORKS_INSPECT, 'network_name')
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$volumes = (new DockerApiRequest($server))
->volumes(ResourceMethods::VOLUMES_LIST)
->get();
use Acamposm\DockerEngineApiPoller\DockerServer;
use Acamposm\DockerEngineApiPoller\DockerApiRequest;
use Acamposm\DockerEngineApiPoller\Enums\ResourceMethods;
$server = (new DockerServer())->server('192.168.10.101');
$volume_details = (new DockerApiRequest($server))
->volumes(ResourceMethods::VOLUMES_INSPECT, 'volume_name')
->get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.