spec: change mount options for /dev/pts in rootless mode
The default /dev/pts has the option gid=5 that might not be mapped in
the rootless case.
Closes:
Approved by: mheon
package createconfig
import (
+ "os"
"strings"
"github.com/docker/docker/daemon/caps"
@@ -44,6 +45,16 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
}
g.AddMount(sysMnt)
}
+ if os.Getuid() != 0 {
+ g.RemoveMount("/dev/pts")
+ devPts := spec.Mount{
+ Destination: "/dev/pts",
+ Type: "devpts",
+ Source: "devpts",
+ Options: []string{"nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620"},
+ }
+ g.AddMount(devPts)
+ }
if addCgroup {
cgroupMnt := spec.Mount{
