Skip to content

Commit 9088a35

Browse files
authored
Merge pull request #8 from treatwell/add-flags-for-security-opts-and-capabilities
Add security options and capabilities flag
2 parents d5aaa4b + e8f1de8 commit 9088a35

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

internal/command/cli.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ func (cli *DebugCli) CreateContainer(attachContainer string, options execOptions
333333
UsernsMode: container.UsernsMode(targetName),
334334
PidMode: container.PidMode(targetName),
335335
Mounts: mounts,
336+
SecurityOpt: options.securityOpts,
337+
CapAdd: options.capAdds,
336338
//VolumesFrom: []string{attachContainer},
337339
}
338340

internal/command/root.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@ import (
1414
var rootCmd = newExecCommand()
1515

1616
type execOptions struct {
17-
host string
18-
image string
19-
detachKeys string
20-
user string
21-
privileged bool
22-
workDir string
23-
targetDir string
24-
container string
25-
certDir string
26-
command []string
27-
name string
28-
volumes []string
29-
ipc bool
17+
host string
18+
image string
19+
detachKeys string
20+
user string
21+
privileged bool
22+
workDir string
23+
targetDir string
24+
container string
25+
certDir string
26+
command []string
27+
name string
28+
volumes []string
29+
ipc bool
30+
securityOpts []string
31+
capAdds []string
3032
}
3133

3234
func newExecOptions() execOptions {
@@ -61,6 +63,8 @@ func newExecCommand() *cobra.Command {
6163
flags.StringVarP(&options.workDir, "work-dir", "w", "", "Working directory inside the container")
6264
_ = flags.SetAnnotation("work-dir", "version", []string{"1.35"})
6365
flags.StringVarP(&options.targetDir, "target-dir", "t", "", "Working directory inside the container")
66+
flags.StringArrayVarP(&options.securityOpts, "security-opts", "s", nil, "Add security options to the Docker container")
67+
flags.StringArrayVarP(&options.capAdds, "cap-adds", "C", nil, "Add Linux capabilities to the Docker container")
6468
flags.BoolVar(&options.ipc, "ipc", false, "share target container ipc")
6569
return cmd
6670
}

0 commit comments

Comments
 (0)