定制 ibra-akv/php-docker-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibra-akv/php-docker-client

最新稳定版本:3.41.3

Composer 安装命令:

composer require ibra-akv/php-docker-client

包简介

Docker API driver for PHP.

README 文档

README

CircleCI Coverage Status

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-22