func registerImageLayer(cake *layercake.Docker, img *image.Image) { tmp, err := ioutil.TempDir("", "my-img") Expect(err).NotTo(HaveOccurred()) defer os.RemoveAll(tmp) Expect(ioutil.WriteFile(path.Join(tmp, img.ID), []byte("Hello"), 0700)).To(Succeed()) archiver, _ := archive.Tar(tmp, archive.Uncompressed) Expect(cake.Register(img, archiver)).To(Succeed()) }
func createContainerLayer(cake *layercake.Docker, id, parent layercake.ID, containerId string) { Expect(cake.Create(id, parent, containerId)).To(Succeed()) }
"github.com/onsi/gomega/gexec" _ "github.com/docker/docker/daemon/graphdriver/aufs" _ "github.com/docker/docker/daemon/graphdriver/vfs" _ "github.com/docker/docker/pkg/chrootarchive" // allow reexec of docker-applyLayer "github.com/docker/docker/pkg/reexec" ) func init() { reexec.Init() } var _ = Describe("Docker", func() { var ( root string driver graphdriver.Driver cake *layercake.Docker ) BeforeEach(func() { var err error root, err = ioutil.TempDir("", "cakeroot") Expect(err).NotTo(HaveOccurred()) Expect(syscall.Mount("tmpfs", root, "tmpfs", 0, "")).To(Succeed()) driver, err := graphdriver.GetDriver("vfs", root, nil) Expect(err).NotTo(HaveOccurred()) graph, err := graph.NewGraph(root, driver) Expect(err).NotTo(HaveOccurred())