Skip to content

Commit 7c0aa1b

Browse files
committed
Fixes to ocitools generate to make it work with runc again
Signed-off-by: Mrunal Patel <[email protected]>
1 parent acc1da1 commit 7c0aa1b

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

generate.go

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ func setupNamespaces(spec *specs.Spec, context *cli.Context) {
599599
spec.Linux.Namespaces = linuxNs
600600
}
601601

602+
func sPtr(s string) *string { return &s }
603+
602604
func getDefaultTemplate() specs.Spec {
603605
spec := specs.Spec{
604606
Version: specs.Version,
@@ -646,8 +648,53 @@ func getDefaultTemplate() specs.Spec {
646648
},
647649
},
648650
Hostname: "shell",
649-
Mounts: []specs.Mount{},
651+
Mounts: []specs.Mount{
652+
{
653+
Destination: "/proc",
654+
Type: "proc",
655+
Source: "proc",
656+
Options: nil,
657+
},
658+
{
659+
Destination: "/dev",
660+
Type: "tmpfs",
661+
Source: "tmpfs",
662+
Options: []string{"nosuid", "strictatime", "mode=755", "size=65536k"},
663+
},
664+
{
665+
Destination: "/dev/pts",
666+
Type: "devpts",
667+
Source: "devpts",
668+
Options: []string{"nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5"},
669+
},
670+
{
671+
Destination: "/dev/shm",
672+
Type: "tmpfs",
673+
Source: "shm",
674+
Options: []string{"nosuid", "noexec", "nodev", "mode=1777", "size=65536k"},
675+
},
676+
{
677+
Destination: "/dev/mqueue",
678+
Type: "mqueue",
679+
Source: "mqueue",
680+
Options: []string{"nosuid", "noexec", "nodev"},
681+
},
682+
{
683+
Destination: "/sys",
684+
Type: "sysfs",
685+
Source: "sysfs",
686+
Options: []string{"nosuid", "noexec", "nodev", "ro"},
687+
},
688+
},
650689
Linux: specs.Linux{
690+
Resources: &specs.Resources{
691+
Devices: []specs.DeviceCgroup{
692+
{
693+
Allow: false,
694+
Access: sPtr("rwm"),
695+
},
696+
},
697+
},
651698
Namespaces: []specs.Namespace{
652699
{
653700
Type: "pid",

0 commit comments

Comments
 (0)