1
0
mirror of https://github.com/rancher/os.git synced 2025-07-13 06:34:04 +00:00

Ignore ErrMountNameConflict when service up

This commit is contained in:
niusmallnan 2019-02-21 17:00:45 +08:00 committed by niusmallnan
parent 7f4f270129
commit 3a88b2e699

View File

@ -2,10 +2,12 @@ package docker
import ( import (
"fmt" "fmt"
"strings"
"github.com/rancher/os/config" "github.com/rancher/os/config"
"github.com/rancher/os/pkg/log" "github.com/rancher/os/pkg/log"
"github.com/docker/docker/layer"
dockerclient "github.com/docker/engine-api/client" dockerclient "github.com/docker/engine-api/client"
"github.com/docker/engine-api/types" "github.com/docker/engine-api/types"
composeConfig "github.com/docker/libcompose/config" composeConfig "github.com/docker/libcompose/config"
@ -148,7 +150,13 @@ func (s *Service) Up(ctx context.Context, options options.Up) error {
} }
for _, c := range cs { for _, c := range cs {
if _, err := c.(*docker.Container).Recreate(ctx, s.Config().Image); err != nil { if _, err := c.(*docker.Container).Recreate(ctx, s.Config().Image); err != nil {
return err // sometimes we can get ErrMountNameConflict when booting on RPi
// ignore this error so that ros can boot success, otherwise it will hang forever
if strings.Contains(err.Error(), layer.ErrMountNameConflict.Error()) {
log.Warn(err)
} else {
return err
}
} }
} }
if err = s.rename(ctx); err != nil { if err = s.rename(ctx); err != nil {