Skip to content

Commit

Permalink
shifting: raise an error if the container needs shifting
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jul 27, 2018
1 parent 06cea37 commit 3f55e5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
Expand Down Expand Up @@ -651,6 +652,12 @@ func (r *layerStore) Mount(id, mountLabel string, uidMaps, gidMaps []idtools.IDM
if mountLabel == "" {
mountLabel = layer.MountLabel
}

if (uidMaps != nil || gidMaps != nil) && !r.driver.SupportsShifting() {
if !reflect.DeepEqual(uidMaps, layer.UIDMap) || !reflect.DeepEqual(gidMaps, layer.GIDMap) {
return "", fmt.Errorf("cannot mount layer %v: shifting not enabled", layer.ID)
}
}
mountpoint, err := r.driver.Get(id, mountLabel, uidMaps, gidMaps)
if mountpoint != "" && err == nil {
if layer.MountPoint != "" {
Expand Down

0 comments on commit 3f55e5a

Please sign in to comment.