Skip to content

Commit

Permalink
feat(toolbox) add $HOME/data for persistent storage
Browse files Browse the repository at this point in the history
Signed-off-by: Rodrigo Chacon <[email protected]>
  • Loading branch information
rochacon committed Jan 6, 2019
1 parent 8d4ce1a commit 72237c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/toolbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ func ensureContainer(username, image, command string) error {
if strings.TrimSpace(string(containerID)) != "" {
return nil
}
// setup data directory for persistent storage
os.MkdirAll(filepath.Join(usr.HomeDir(), "data"), 0750)
// create container
createArgs := []string{
"container",
"create",
Expand All @@ -135,6 +138,7 @@ func ensureContainer(username, image, command string) error {
"--env=USER=" + usr.Username,
fmt.Sprintf("--mount=type=bind,source=/etc/group,destination=/etc/group,bind-propagation=rprivate,readonly"),
fmt.Sprintf("--mount=type=bind,source=/etc/passwd,destination=/etc/passwd,bind-propagation=rprivate,readonly"),
fmt.Sprintf("--mount=type=bind,source=%s/data,destination=%s/data,bind-propagation=rprivate", usr.HomeDir(), usr.HomeDir()),
fmt.Sprintf("--mount=type=tmpfs,destination=%s,tmpfs-size=8192", filepath.Join(usr.HomeDir(), ".aws")),
"--user", fmt.Sprintf("%d", usr.Uid()),
"--workdir", usr.HomeDir(),
Expand Down

0 comments on commit 72237c0

Please sign in to comment.