Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootable containers #10

Merged
merged 3 commits into from
Aug 2, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/mobynit/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"io/ioutil"
"log"
"os"
Expand All @@ -20,6 +21,13 @@ const (
PIVOT_PATH = "/mnt/sysroot"
)

var graphDriver string

func init() {
flag.StringVar(&graphDriver, "storage-driver", "aufs", "Storage driver to use")
flag.StringVar(&graphDriver, "s", "aufs", "Storage driver to use")
Copy link
Contributor

@zozo123 zozo123 Aug 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second flag.StringVar will override the first one. I am not sure I get this. https://play.golang.org/p/7Pr_o3He8V

}

func mountContainer(containerID string) string {
if err := unix.Mount("", "/", "", unix.MS_REMOUNT, ""); err != nil {
log.Fatal("error remounting root as read/write:", err)
Expand All @@ -39,7 +47,7 @@ func mountContainer(containerID string) string {
StorePath: LAYER_ROOT,
MetadataStorePathTemplate: filepath.Join(LAYER_ROOT, "image", "%s", "layerdb"),
IDMappings: &idtools.IDMappings{},
GraphDriver: "aufs",
GraphDriver: graphDriver,
Platform: "linux",
})
if err != nil {
Expand Down Expand Up @@ -69,6 +77,8 @@ func mountContainer(containerID string) string {
}

func main() {
flag.Parse()

rawID, err := ioutil.ReadFile("/current/container_id")
if err != nil {
log.Fatal("could not get container ID:", err)
Expand Down