mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #31674 from dperny/service-logs-err-on-tty
Error on attempting services logs on TTY container
This commit is contained in:
commit
47615d9871
2 changed files with 13 additions and 0 deletions
|
@ -397,6 +397,12 @@ func (c *containerAdapter) deactivateServiceBinding() error {
|
|||
}
|
||||
|
||||
func (c *containerAdapter) logs(ctx context.Context, options api.LogSubscriptionOptions) (io.ReadCloser, error) {
|
||||
// we can't handle the peculiarities of a TTY-attached container yet
|
||||
conf := c.container.config()
|
||||
if conf != nil && conf.Tty {
|
||||
return nil, errors.New("logs not supported on containers with a TTY attached")
|
||||
}
|
||||
|
||||
reader, writer := io.Pipe()
|
||||
|
||||
apiOptions := &backend.ContainerLogsConfig{
|
||||
|
|
|
@ -262,6 +262,13 @@ func (c *Cluster) ServiceLogs(ctx context.Context, input string, config *backend
|
|||
c.mu.RUnlock()
|
||||
return err
|
||||
}
|
||||
container := service.Spec.Task.GetContainer()
|
||||
if container == nil {
|
||||
return errors.New("service logs only supported for container tasks")
|
||||
}
|
||||
if container.TTY {
|
||||
return errors.New("service logs not supported on tasks with a TTY attached")
|
||||
}
|
||||
|
||||
// set the streams we'll use
|
||||
stdStreams := []swarmapi.LogStream{}
|
||||
|
|
Loading…
Add table
Reference in a new issue