Merge pull request #579 from alexlarsson/non-terminal-attach

Implement non-terminal attach
This commit is contained in:
Mrunal Patel 2017-06-14 21:45:44 -07:00 committed by GitHub
commit 7b9032bac7
8 changed files with 143 additions and 42 deletions

View file

@ -31,6 +31,8 @@ type Container struct {
sandbox string
netns ns.NetNS
terminal bool
stdin bool
stdinOnce bool
privileged bool
state *ContainerState
metadata *pb.ContainerMetadata
@ -54,7 +56,7 @@ type ContainerState struct {
}
// NewContainer creates a container object.
func NewContainer(id string, name string, bundlePath string, logPath string, netns ns.NetNS, labels map[string]string, annotations map[string]string, image *pb.ImageSpec, metadata *pb.ContainerMetadata, sandbox string, terminal bool, privileged bool, dir string, created time.Time, stopSignal string) (*Container, error) {
func NewContainer(id string, name string, bundlePath string, logPath string, netns ns.NetNS, labels map[string]string, annotations map[string]string, image *pb.ImageSpec, metadata *pb.ContainerMetadata, sandbox string, terminal bool, stdin bool, stdinOnce bool, privileged bool, dir string, created time.Time, stopSignal string) (*Container, error) {
state := &ContainerState{}
state.Created = created
c := &Container{
@ -66,6 +68,8 @@ func NewContainer(id string, name string, bundlePath string, logPath string, net
sandbox: sandbox,
netns: netns,
terminal: terminal,
stdin: stdin,
stdinOnce: stdinOnce,
privileged: privileged,
metadata: metadata,
annotations: annotations,

View file

@ -121,6 +121,8 @@ func (r *Runtime) CreateContainer(c *Container, cgroupParent string) error {
args = append(args, "-l", c.logPath)
if c.terminal {
args = append(args, "-t")
} else if c.stdin {
args = append(args, "-i")
}
logrus.WithFields(logrus.Fields{
"args": args,