Do not print error message when container does not exist

This fixes a condition when a container is removed while
following the logs and prints an error when the container
is removed forcefully.

Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
This commit is contained in:
jgallucci32
2020-06-12 12:59:58 -07:00
parent e714352501
commit d514e3c097

View File

@ -78,9 +78,11 @@ func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *l
if options.Follow { if options.Follow {
for { for {
state, err := c.State() state, err := c.State()
if err != nil { if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
logrus.Error(err) logrus.Error(err)
break break
} else if err != nil {
break
} }
if state != define.ContainerStateRunning && state != define.ContainerStatePaused { if state != define.ContainerStateRunning && state != define.ContainerStatePaused {
err := t.Stop() err := t.Stop()