A modern PHP client for the Docker Engine API (v1.51+), built with JanePHP.
use WebProject\DockerApiClient\Client\DockerApiClientWrapper;
use WebProject\DockerApiClient\Service\DockerService;
$service = new DockerService(
DockerApiClientWrapper::create('http://localhost', '/var/run/docker.sock')
);// List and inspect containers
foreach ($service->findAllContainer() as $container) {
echo "{$container->getName()}: " . ($container->running ? 'Running' : 'Stopped') . "
";
// Extract env-based URLs
$urls = $container->extractUrlsFromEnvVars(['VIRTUAL_HOST']);
}bin/docker-api docker:list-containersPull Requests are welcome.
MIT License.