1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add support for stdin_open in composefile v3

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-11-11 15:15:10 +01:00
parent bc739a8d70
commit 84450b72cd
4 changed files with 29 additions and 24 deletions

View file

@ -33,6 +33,7 @@ type ContainerSpec struct {
User string `json:",omitempty"` User string `json:",omitempty"`
Groups []string `json:",omitempty"` Groups []string `json:",omitempty"`
TTY bool `json:",omitempty"` TTY bool `json:",omitempty"`
OpenStdin bool `json:",omitempty"`
Mounts []mount.Mount `json:",omitempty"` Mounts []mount.Mount `json:",omitempty"`
StopGracePeriod *time.Duration `json:",omitempty"` StopGracePeriod *time.Duration `json:",omitempty"`
Healthcheck *container.HealthConfig `json:",omitempty"` Healthcheck *container.HealthConfig `json:",omitempty"`

View file

@ -505,6 +505,7 @@ func convertService(
Mounts: mounts, Mounts: mounts,
StopGracePeriod: service.StopGracePeriod, StopGracePeriod: service.StopGracePeriod,
TTY: service.Tty, TTY: service.Tty,
OpenStdin: service.StdinOpen,
}, },
Resources: resources, Resources: resources,
RestartPolicy: restartPolicy, RestartPolicy: restartPolicy,

View file

@ -14,18 +14,19 @@ import (
func containerSpecFromGRPC(c *swarmapi.ContainerSpec) types.ContainerSpec { func containerSpecFromGRPC(c *swarmapi.ContainerSpec) types.ContainerSpec {
containerSpec := types.ContainerSpec{ containerSpec := types.ContainerSpec{
Image: c.Image, Image: c.Image,
Labels: c.Labels, Labels: c.Labels,
Command: c.Command, Command: c.Command,
Args: c.Args, Args: c.Args,
Hostname: c.Hostname, Hostname: c.Hostname,
Env: c.Env, Env: c.Env,
Dir: c.Dir, Dir: c.Dir,
User: c.User, User: c.User,
Groups: c.Groups, Groups: c.Groups,
TTY: c.TTY, TTY: c.TTY,
Hosts: c.Hosts, OpenStdin: c.OpenStdin,
Secrets: secretReferencesFromGRPC(c.Secrets), Hosts: c.Hosts,
Secrets: secretReferencesFromGRPC(c.Secrets),
} }
if c.DNSConfig != nil { if c.DNSConfig != nil {
@ -123,18 +124,19 @@ func secretReferencesFromGRPC(sr []*swarmapi.SecretReference) []*types.SecretRef
func containerToGRPC(c types.ContainerSpec) (*swarmapi.ContainerSpec, error) { func containerToGRPC(c types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
containerSpec := &swarmapi.ContainerSpec{ containerSpec := &swarmapi.ContainerSpec{
Image: c.Image, Image: c.Image,
Labels: c.Labels, Labels: c.Labels,
Command: c.Command, Command: c.Command,
Args: c.Args, Args: c.Args,
Hostname: c.Hostname, Hostname: c.Hostname,
Env: c.Env, Env: c.Env,
Dir: c.Dir, Dir: c.Dir,
User: c.User, User: c.User,
Groups: c.Groups, Groups: c.Groups,
TTY: c.TTY, TTY: c.TTY,
Hosts: c.Hosts, OpenStdin: c.OpenStdin,
Secrets: secretReferencesToGRPC(c.Secrets), Hosts: c.Hosts,
Secrets: secretReferencesToGRPC(c.Secrets),
} }
if c.DNSConfig != nil { if c.DNSConfig != nil {

View file

@ -185,6 +185,7 @@ func (c *containerConfig) config() *enginecontainer.Config {
config := &enginecontainer.Config{ config := &enginecontainer.Config{
Labels: c.labels(), Labels: c.labels(),
Tty: c.spec().TTY, Tty: c.spec().TTY,
OpenStdin: c.spec().OpenStdin,
User: c.spec().User, User: c.spec().User,
Env: c.spec().Env, Env: c.spec().Env,
Hostname: c.spec().Hostname, Hostname: c.spec().Hostname,