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