Class: Docker::Template::Rootfs

Inherits:
Common show all
Defined in:
lib/docker/template/rootfs.rb

Constant Summary

Constants inherited from Common

Common::CopyMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Common

#aliased?, #build, #chdir_build, #parent_img, #parent_repo, #push

Constructor Details

#initialize(repo) ⇒ Rootfs

Returns a new instance of Rootfs.



9
10
11
# File 'lib/docker/template/rootfs.rb', line 9

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

#imgObject (readonly)

Returns the value of attribute img.



8
9
10
# File 'lib/docker/template/rootfs.rb', line 8

def img
  @img
end

Instance Method Details

#dataObject



21
22
23
24
25
# File 'lib/docker/template/rootfs.rb', line 21

def data
  Template.get(:rootfs, {
    :rootfs_base_img => @repo.["rootfs_base_img"]
  })
end

#rootfs?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/docker/template/rootfs.rb', line 15

def rootfs?
  true
end

In a typical situation we do not remove the rootfs img and don’t recommend removing it as it’s better cached by Docker, if you wish to delete it we will. Now, here we only remove it if we get told to exit, since we will be in the middle of a build and probably not have tagged yet, unless we are downstream, we will remove it so you have no broken images on your system.



34
35
36
37
38
39
40
# File 'lib/docker/template/rootfs.rb', line 34

def unlink(img: true)
  keep = @repo.["keep_rootfs"]
  @img.delete "force" => true if img && @img && !keep
  @context.rmtree if @context && @context.directory?
rescue Docker::Error::NotFoundError
  nil
end