Skip to content

Instantly share code, notes, and snippets.

@ucarion
Created August 22, 2013 03:30
Show Gist options
  • Save ucarion/6302908 to your computer and use it in GitHub Desktop.
Save ucarion/6302908 to your computer and use it in GitHub Desktop.
Call Docker image through bash
require 'docker'
require 'shellwords'
image = Docker::Image.all.first
s = IO.read('tmp.rb').shellescape
cmd = [ "/bin/bash", "-c", "echo #{s} > roobee.rb; ruby roobee.rb" ]
puts "Response from Docker: "
puts image.run(cmd).attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment