https://github.com/jeromegn/docker.cr
Docker API client in Crystal.
https://github.com/jeromegn/docker.cr
Last synced: about 1 year ago
JSON representation
Docker API client in Crystal.
- Host: GitHub
- URL: https://github.com/jeromegn/docker.cr
- Owner: jeromegn
- License: mit
- Created: 2016-03-20T21:47:56.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T20:50:51.000Z (almost 5 years ago)
- Last Synced: 2025-03-26T06:34:36.954Z (about 1 year ago)
- Language: Crystal
- Homepage:
- Size: 55.7 KB
- Stars: 26
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - jeromegn/docker.cr - Docker API client in Crystal. (<a name="Crystal"></a>Crystal)
README
# Crystal Docker API client
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
docker:
github: jeromegn/docker.cr
```
## Status: Developer Preview
This is not nearly complete. Just got the initial connecting working and simple casting. I added a few commands as a proof of concept.
This shard extends OpenSSL and HTTP::Client a little bit to support Docker's SSL method (TLS V1.)
## Usage
```crystal
require "docker"
```
### Options
By default, options will be taken from the environment variables:
```
DOCKER_URL or DOCKER_HOST
DOCKER_VERIFY_TLS
DOCKER_CERT_PATH
```
but they can also be set manually like:
```crystal
Docker.client.url = "tcp://192.168.99.100:2376"
Docker.client.verify_tls = true
Docker.client.cert_path = "#{ENV["HOME"]}/.docker"
```
If nothing is set, this client will use the unix socket.
### Info
```crystal
Docker.client.info.container # => Returns container count
```
### Containers
```crystal
Docker.client.containers # => Array of Docker::Container
container = Docker.client.containers.first
p container # => #
container.stop
container.start
container.restart
container.kill
```
## Contributing
1. Fork it ( https://github.com/jeromegn/docker.cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [jeromegn](https://github.com/jeromegn) Jerome Gravel-Niquet - creator, maintainer