lib/dockdev/image.rb in dockdev-0.1.0 vs lib/dockdev/image.rb in dockdev-0.2.0
- old
+ new
@@ -32,14 +32,19 @@
def build(dockerfile, opts = {})
optss = {
context_root: opts[:root],
dockerfile: dockerfile
}
- res = @cmd_fact.build_image(@image_name, optss).run
- if res.success?
- new_container(opts[:container_name], opts)
+ optss.merge!(opts)
+ @cmd_fact.build_image(@image_name, optss).run
+ end
+
+ def destroy
+ res = @cmd_fact.delete_image(@image_name).run
+ if res.success?
+ not res.is_out_stream_empty?
else
- raise Error, "Error triggered during find existing image : #{res.err_stream}"
+ raise Error, "Error triggered during deleting image : #{res.err_stream}"
end
end
end
end