Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
| ... | ... |
@@ -18,8 +18,8 @@ import ( |
| 18 | 18 |
|
| 19 | 19 |
type ExecConfig struct {
|
| 20 | 20 |
ProcessConfig execdriver.ProcessConfig |
| 21 |
- StreamConfig StreamConfig |
|
| 22 |
- OpenStdin bool |
|
| 21 |
+ StreamConfig |
|
| 22 |
+ OpenStdin bool |
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
func (d *Daemon) ContainerExec(job *engine.Job) engine.Status {
|
| ... | ... |
@@ -92,7 +92,6 @@ func (d *Daemon) ContainerExec(job *engine.Job) engine.Status {
|
| 92 | 92 |
attachErr = d.Attach(&execConfig.StreamConfig, config.AttachStdin, false, config.Tty, cStdin, cStdinCloser, cStdout, cStderr) |
| 93 | 93 |
}() |
| 94 | 94 |
|
| 95 |
- log.Debugf("Exec Config is %+v\n", execConfig)
|
|
| 96 | 95 |
go func() {
|
| 97 | 96 |
err := container.Exec(execConfig) |
| 98 | 97 |
if err != nil {
|
| ... | ... |
@@ -22,6 +22,7 @@ import ( |
| 22 | 22 |
"github.com/docker/libcontainer/cgroups/systemd" |
| 23 | 23 |
consolepkg "github.com/docker/libcontainer/console" |
| 24 | 24 |
"github.com/docker/libcontainer/namespaces" |
| 25 |
+ _ "github.com/docker/libcontainer/namespaces/nsenter" |
|
| 25 | 26 |
"github.com/docker/libcontainer/system" |
| 26 | 27 |
) |
| 27 | 28 |
|
| ... | ... |
@@ -37,6 +37,7 @@ func nsenterExec() {
|
| 37 | 37 |
} |
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 |
+// TODO(vishh): Add support for running in priviledged mode and running as a different user. |
|
| 40 | 41 |
func (d *driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
|
| 41 | 42 |
active := d.activeContainers[c.ID] |
| 42 | 43 |
if active == nil {
|
| ... | ... |
@@ -15,7 +15,6 @@ type ExecConfig struct {
|
| 15 | 15 |
AttachStdout bool |
| 16 | 16 |
Detach bool |
| 17 | 17 |
Cmd []string |
| 18 |
- Hostname string |
|
| 19 | 18 |
} |
| 20 | 19 |
|
| 21 | 20 |
func ExecConfigFromJob(job *engine.Job) *ExecConfig {
|
| ... | ... |
@@ -37,14 +36,11 @@ func ExecConfigFromJob(job *engine.Job) *ExecConfig {
|
| 37 | 37 |
|
| 38 | 38 |
func ParseExec(cmd *flag.FlagSet, args []string) (*ExecConfig, error) {
|
| 39 | 39 |
var ( |
| 40 |
- flPrivileged = cmd.Bool([]string{"#privileged", "-privileged"}, false, "Give extended privileges to this container")
|
|
| 41 |
- flStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
|
|
| 42 |
- flTty = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
|
|
| 43 |
- flHostname = cmd.String([]string{"h", "-hostname"}, "", "Container host name")
|
|
| 44 |
- flUser = cmd.String([]string{"u", "-user"}, "", "Username or UID")
|
|
| 45 |
- flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run command in the background")
|
|
| 46 |
- execCmd []string |
|
| 47 |
- container string |
|
| 40 |
+ flStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
|
|
| 41 |
+ flTty = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
|
|
| 42 |
+ flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run command in the background")
|
|
| 43 |
+ execCmd []string |
|
| 44 |
+ container string |
|
| 48 | 45 |
) |
| 49 | 46 |
if err := cmd.Parse(args); err != nil {
|
| 50 | 47 |
return nil, err |
| ... | ... |
@@ -56,12 +52,13 @@ func ParseExec(cmd *flag.FlagSet, args []string) (*ExecConfig, error) {
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
execConfig := &ExecConfig{
|
| 59 |
- User: *flUser, |
|
| 60 |
- Privileged: *flPrivileged, |
|
| 59 |
+ // TODO(vishh): Expose '-u' flag once it is supported. |
|
| 60 |
+ User: "", |
|
| 61 |
+ // TODO(vishh): Expose '-p' flag once it is supported. |
|
| 62 |
+ Privileged: false, |
|
| 61 | 63 |
Tty: *flTty, |
| 62 | 64 |
Cmd: execCmd, |
| 63 | 65 |
Container: container, |
| 64 |
- Hostname: *flHostname, |
|
| 65 | 66 |
Detach: *flDetach, |
| 66 | 67 |
} |
| 67 | 68 |
|