Change missing image detection for create

Daemon may not respond with the same image name
any more but it may be in a normalized form.
Generally checking for a container name doesn’t 
seem like a good idea because small image names
may match any possible error.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2016-01-11 12:05:28 -08:00
Родитель 259fce04b5
Коммит a4ec5b48ec
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -33,13 +33,13 @@ func (cli *Client) ContainerCreate(config *container.Config, hostConfig *contain
serverResp, err := cli.post("/containers/create", query, body, nil)
if err != nil {
if serverResp != nil && serverResp.statusCode == 404 && strings.Contains(err.Error(), config.Image) {
if serverResp != nil && serverResp.statusCode == 404 && strings.Contains(err.Error(), "No such image") {
return response, imageNotFoundError{config.Image}
}
return response, err
}
if serverResp.statusCode == 404 && strings.Contains(err.Error(), config.Image) {
if serverResp.statusCode == 404 && strings.Contains(err.Error(), "No such image") {
return response, imageNotFoundError{config.Image}
}