Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soyhuce/laravel-docker
Interact with a Docker instance
https://github.com/soyhuce/laravel-docker
api docker hacktoberfest laravel socket
Last synced: about 2 months ago
JSON representation
Interact with a Docker instance
- Host: GitHub
- URL: https://github.com/soyhuce/laravel-docker
- Owner: Soyhuce
- License: mit
- Created: 2020-05-13T08:18:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T14:20:54.000Z (10 months ago)
- Last Synced: 2024-11-24T20:50:09.800Z (about 2 months ago)
- Topics: api, docker, hacktoberfest, laravel, socket
- Language: PHP
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Docker
[![Latest Version on Packagist](https://img.shields.io/packagist/v/soyhuce/laravel-docker.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-docker)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-docker/run-tests?label=tests)
[![Total Downloads](https://img.shields.io/packagist/dt/soyhuce/laravel-docker.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-docker)This package allows you to communicate with a Docker instance via unix socket or API.
API mode is based on [API Docker Engine](https://docs.docker.com/engine/api/v1.40)
## 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:,reuseaddr,fork UNIX-CLIENT:`
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:',
]
],
]
```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