GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - docker-php/docker-php at v3.1.0

BranchesTags
Open more actions menu

Latest commit

 

History

672 Commits
672 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.php-cs-fixer.php
.php-cs-fixer.php
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
DOCUMENTATION.md
DOCUMENTATION.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

Docker PHP

Docker PHP (for lack of a better name) is a Docker client written in PHP. This library aims to reach 100% API support of the Docker Engine.

Documentation Latest Version Software License Total Downloads

Documentation

The version 3.x documentation is available. Its source lives in docs/; see DOCUMENTATION.md to preview and edit it locally. The legacy documentation remains available for earlier releases.

New maintainers

After this repository was archived in 2019, the code was forked in beluga-php/docker-php, where maintenance and improvements continued.

We later contacted joelwurtz and agreed to take over maintenance of the original docker-php/docker-php repository to give you a better upgrade path. Development will continue here, and we will archive beluga-php/docker-php once the migration is complete.

Version 3.0 targets Docker Engine API v1.45. We plan to add the missing API versions and bring support up to the latest Docker Engine API. See Upgrading to 3.0 below for how to migrate from existing releases.

Requirements

  • PHP 8.1 or later, with the mbstring extension.
  • Composer.
  • Access to a Docker daemon that accepts API v1.45 requests.

Installation

composer require "docker-php/docker-php:^3.0"

Composer installs docker-php/docker-php-api as a dependency. The 3.0 release targets Docker API v1.45 and requires the matching generated API package.

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use Docker\Docker;

$docker = Docker::create();

foreach ($docker->containerList(['all' => true]) as $container) {
    printf("%s\t%s\n", $container->getId(), $container->getImage());
}

Endpoint methods return generated models where the API defines a response body. Their PHPDoc lists accepted parameters, return types and API exceptions.

Docker::create() connects through unix:///var/run/docker.sock by default. Environment variables are optional. See connection settings and the Guzzle examples for custom sockets, remote daemons and TLS configuration.

For streaming output, see container logs, command output and the streaming reference. These guides cover callback streams, TTY output and raw response framing.

Docker API versions

See the official Docker Engine API v1.45 reference for endpoint descriptions, parameters and response schemas matching this API line.

The client package follows semantic versioning. The generated API package uses Jane-major.Docker-major.Docker-minor.revision: 7.1.45.0 means Docker API 1.45, generated with Jane 7, revision 0.

Keep generated API dependencies within one Docker specification. The 3.0 client uses this range:

"docker-php/docker-php-api": ">=7.1.45.0 <7.1.46.0"

With the default connection factory, DOCKER_API_VERSION overrides the version in request URLs:

DOCKER_API_VERSION=1.52 php your-script.php

Since 3.1.0, the factory's api_version option can pin the request version directly in PHP. It takes precedence over DOCKER_API_VERSION. See connection settings.

The generated endpoints and models still describe API v1.45. Changing the URL version does not add newer API fields or endpoints. The client does not automatically negotiate an API version with the daemon.

Upgrading to 3.0

From docker-php 2.x

Version 3.0 requires PHP 8.1 or later, PSR-7 v2 and Jane 7-generated models. Review endpoint signatures, model types and HTTP client dependencies before upgrading. Check log and exec consumers against the streaming documentation.

Change the client requirement to docker-php/docker-php:^3.0. Remove an explicit docker-php/docker-php-api:4.1.* requirement, or change it to the API 1.45 range shown above. Update dependencies, test your application and commit its updated composer.lock.

From beluga-php

Version 3.0 continues the client maintained under beluga-php/docker-php. The PHP namespaces remain Docker and Docker\API.

Remove the beluga-php/docker-php requirement and any explicit beluga-php/docker-php-api requirement from composer.json. Add docker-php/docker-php:^3.0; add the API 1.45 range above if your application requires the generated API package directly. Resolve the package changes together, then test the application and commit its updated composer.lock.

Install one package family at a time: the Beluga and original packages contain the same PHP classes.

Development

Install dependencies and pull the image used by the integration tests:

composer install
docker pull busybox:latest

Run the test suite and static analysis:

composer run-script test-ci
composer run-script phpstan

The integration tests create Docker resources on the configured daemon. Use a development daemon when running them. See CONTRIBUTING.md for contribution instructions.

Credits

Docker PHP was created by Geoffrey Bachelet and Joel Wurtz. Development continued under beluga-php before the return to the original repositories.

License

MIT.

About

A Docker client in PHP

docker-php.mintlify.site/

Resources

Readme
License

Contributing

Contributing
Activity
Custom properties

Stars

766 stars

Watchers

1 watching

Forks

265 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.