Vendor containers/storage for better error reporting on dups

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #971
Approved by: mheon
This commit is contained in:
Daniel J Walsh
2018-06-20 07:54:39 -04:00
committed by Atomic Bot
parent f228cf73e0
commit da29c52c15
4 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package storage
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -278,7 +279,8 @@ func (r *containerStore) Create(id string, names []string, image, layer, metadat
names = dedupeNames(names)
for _, name := range names {
if _, nameInUse := r.byname[name]; nameInUse {
return nil, ErrDuplicateName
return nil, errors.Wrapf(ErrDuplicateName,
fmt.Sprintf("the container name \"%s\" is already in use by \"%s\". You have to remove that container to be able to reuse that name.", name, r.byname[name].ID))
}
}
if err == nil {