Docker::Porcelain
Porcelain for the Docker API.
Installation
Add this line to your application's Gemfile:
gem 'docker-porcelain'
And then execute:
$ bundle
Or install it yourself as:
$ gem install docker-porcelain
Usage
There's several styles of using docker-porcelain:
Monkey-patching (AKA global extensions)
Recommended for application code unless it causes problems.
require 'docker/porcelain/extensions'
container = Docker::Container.create 'Image' => 'alpine'
container.write '/tmp/foo', 'This is the foo file!'
Note this will monkey patch docker-api classes, which might not be what you want (especially in a library).
Object extensions
You can extend individual objects (recommended for library code):
require 'docker/porcelain'
container = Docker::Container.create 'Image' => 'alpine'
container.extend Docker::Porcelain::Container
container.write '/tmp/foo', 'This is the foo file!'
Refinements
Not recommended, and it might not work as expected, but you can experiment:
require 'docker/porcelain/refinements'
using Docker::Porcelain
container = Docker::Container.create 'Image' => 'alpine'
container.write '/tmp/foo', 'This is the foo file!'
Synopsis
container.write '/tmp/foo', 'This is the foo file!'
container.system 'true' or fail "there's no truth in the container!"
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake rspec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/conjurinc/docker-porcelain.
License
The gem is available as open source under the terms of the MIT License.