定制 soyhuce/laravel-docker 二次开发

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

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

soyhuce/laravel-docker

Composer 安装命令:

composer require soyhuce/laravel-docker

包简介

Interact with a Docker instance

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status GitHub PHPStan Action Status Total Downloads

This package allows you to communicate with a Docker instance via unix socket or API.

API mode is based on API Docker Engine

Installation

You can install the package via composer:

composer require soyhuce/laravel-docker

Utilisation

Configuration

Publish configuration file via:

php artisan vendor:publish --provider="Soyhuce\Docker\ServiceProvider"

API

To use this package with API drive, you can expose Docker on HTTP port.

For example, you can do this:

socat TCP-LISTEN:<port-number>,reuseaddr,fork UNIX-CLIENT:<path-to-unix-socket>

So, in your configuration file, you have to define your configuration file like this:

[
    'driver' => 'api',
    'version' => 'v1.40',
    'drivers' => [
        'api' => [
            'url' => 'http://127.0.0.1:<port-number>',
        ]
    ],
]

You can also use the unix socket to connect to Docker :

[
    'driver' => 'api',
    'version' => 'v1.40',
    'drivers' => [
        'socket' => [
            'unix_socket' => '/var/run/docker.sock',
        ],
    ],
]

Working with Docker containers

  • create($imageName, $containerName) : Create a container from an image
  • start($containerId) : Start a container from its name or id
  • stop($containerId) : Stop a container from its name or id
  • wait($containerId) : Wait a container from its name or id
  • delete($containerId) : Delete a container from its name or id

Working with Docker images

  • create($imageName, $tagName) : Pull an image
  • all() : Retrieve all images on your Docker instance
  • remove($imageName) : Remove an image from its name

统计信息

  • 总下载量: 13.55k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固