Builds Docker image, runs it, and kills

DevOps By Rultor.com We recommend RubyMine

rake PDD status Gem Version Test Coverage Yard Docs Hits-of-Code License

This small Ruby library helps building temporary Docker images, run Docker containers, and clean up afterwards --- may be convenient for automated tests (for example, with Minitest):

class MyTest < Minitest::Test
  def test_prints_hello_world
    stdout = donce(
      dockerfile: '
        FROM ubuntu
        CMD echo "Hello, world!"
      '
    )
    assert_equal("Hello, world!\n", stdout)
  end
end

That's it.

How to contribute

Read these guidelines. Make sure you build is green before you contribute your pull request. You will need to have Ruby 3.2+ and Bundler installed. Then:

bundle update
bundle exec rake

If it's clean and you don't see any error messages, submit your pull request.