Skip to content

Instantly share code, notes, and snippets.

@ryotarai
Created August 29, 2016 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryotarai/ebbb22f3ed783479381c6d6ceab57d61 to your computer and use it in GitHub Desktop.
Save ryotarai/ebbb22f3ed783479381c6d6ceab57d61 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'json'
require 'shellwords'
cid = ARGV[0]
JSON.parse(`docker inspect #{cid}`).each do |c|
config = c['Config']
args = %w!docker run -it!
config['Env'].each do |e|
args << '-e' << e
end
args << c['Image']
args += config['Cmd']
puts args.shelljoin
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment