Coder Social home page Coder Social logo

docker.cr's Introduction

Crystal Docker API client

Installation

Add this to your application's shard.yml:

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

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:

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

Docker.client.info.container # => Returns container count

Containers

Docker.client.containers # => Array of Docker::Container
container = Docker.client.containers.first
p container # => #<Docker::Container:0x10f6a3ea0 @id="cbbeb51f25b4c91b61e6d1b5fc0c1c2bb470ccd8aaf5dc4a57885f35f21d7245", @names=["api"], @image="ruby" ...>

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 Jerome Gravel-Niquet - creator, maintainer

docker.cr's People

Contributors

jeromegn avatar bramswenson avatar hholst80 avatar ysbaddaden avatar tobyapi avatar utay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.