Skip to content

Commit

Permalink
overlay: honor ro option
Browse files Browse the repository at this point in the history
if "ro" is specified when mounting overlay, configure overlay without
any upper layer and workdir so the file system doesn't attempt to
write any file.

Closes: containers/buildah#2359

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed May 16, 2020
1 parent c37a306 commit 95d90c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,13 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
}
readWrite := true

for _, o := range options.Options {
if o == "ro" {
readWrite = false
break
}
}

lowers, err := ioutil.ReadFile(path.Join(dir, lowerFile))
if err != nil && !os.IsNotExist(err) {
return "", err
Expand Down

0 comments on commit 95d90c1

Please sign in to comment.