Add privileged flag

master
Hugo Thunnissen 2 years ago
parent 3066ff4243
commit 56e110e22c

@ -165,7 +165,7 @@ func EntryPoint(command []string) error {
return syscall.Exec(path, command, os.Environ()) return syscall.Exec(path, command, os.Environ())
} }
func Run(detach bool, mounts []string, command []string) error { func Run(privileged bool, detach bool, mounts []string, command []string) error {
workDir, err := os.Getwd() workDir, err := os.Getwd()
if err != nil { if err != nil {
return err return err
@ -249,6 +249,10 @@ func Run(detach bool, mounts []string, command []string) error {
) )
} }
if privileged {
dockerCommand = append(dockerCommand, "--privileged")
}
if detach { if detach {
dockerCommand = append(dockerCommand, "--detach") dockerCommand = append(dockerCommand, "--detach")
} }
@ -398,6 +402,14 @@ func main() {
"Whether or not to detach from the container after running the command", "Whether or not to detach from the container after running the command",
) )
var privileged bool
run.BoolVar(
&privileged,
"privileged",
false,
"Whether or not to detach from the container after running the command",
)
var mounts arrayFlag var mounts arrayFlag
run.Var(&mounts, "mount", "Directory to mount inside the workspace container") run.Var(&mounts, "mount", "Directory to mount inside the workspace container")
@ -416,7 +428,7 @@ func main() {
os.Exit(1) os.Exit(1)
} }
err = Run(detach, mounts, run.Args()) err = Run(privileged, detach, mounts, run.Args())
if err != nil { if err != nil {
fmt.Println("error running command in container", err) fmt.Println("error running command in container", err)
os.Exit(1) os.Exit(1)

Loading…
Cancel
Save