mirror of
https://github.com/docker/cli.git
synced 2026-01-19 21:41:31 +03:00
Merge pull request #2904 from SvenDowideit/dont-show-user-internal-slash-in-error-message
there appears to be a slash prepended to a container name internally Upstream-commit: f75dc36204b37d9cb292fd3cf949e1cec1142c36 Component: engine
This commit is contained in:
@@ -422,7 +422,8 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
|
||||
if _, err := runtime.containerGraph.Set(name, id); err != nil {
|
||||
if strings.HasSuffix(err.Error(), "name are not unique") {
|
||||
conflictingContainer, _ := runtime.GetByName(name)
|
||||
return nil, nil, fmt.Errorf("Conflict, The name %s is already assigned to %s. You have to delete (or rename) that container to be able to assign %s to a container again.", name, utils.TruncateID(conflictingContainer.ID), name)
|
||||
nameAsKnownByUser := strings.TrimPrefix(name, "/")
|
||||
return nil, nil, fmt.Errorf("Conflict, The name %s is already assigned to %s. You have to delete (or rename) that container to be able to assign %s to a container again.", nameAsKnownByUser, utils.TruncateID(conflictingContainer.ID), nameAsKnownByUser)
|
||||
}
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user