ibra-akv/php-docker-client
最新稳定版本:3.41.3
Composer 安装命令:
composer require ibra-akv/php-docker-client
包简介
Docker API driver for PHP.
README 文档
README
Docker API driver for PHP.
Docker configuration
Docker Engine API must be exposed on a local port in order to be able to connect.
1. Edit the docker.service which by default on debian is located at /lib/systemd/system/docker.service
From this:
# /lib/systemd/system/docker.service
...
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
...
To this:
# /lib/systemd/system/docker.service
...
ExecStart=/usr/bin/dockerd
...
2. Edit /etc/docker/daemon.json to expose docker api at 127.0.0.1:2375
Add hosts to the json file as next:
{
...
"hosts": ["fd://", "tcp://127.0.0.1:2375"]
...
}
3. Restart Docker completely
systemctl daemon-reload systemctl restart docker service docker restart
Installation
composer require ibra-akv/php-docker-client
Usage
Initialize client
use IterativeCode\Component\DockerClient\DockerClient; $docker = new DockerClient([ 'local_endpoint' => 'http://localhost:2375/v1.41', # Optional (default: http://localhost:2375) ]);
Check if image exists
$exists = $docker->imageExists('436aed837ea2'); # true | false $details = $docker->inspectImage('436aedXXXXXX'); # array | @throws Exception
API Reference
Tested Docker versions
License
统计信息
- 总下载量: 62
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-22