mirror of https://github.com/docker/docs.git
Fix error for restarting container
Fix error message for `--net container:b` and `--ipc container:b`, container `b` is a restarting container. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
38e774d32c
commit
3c0a91d227
|
@ -975,6 +975,9 @@ func (daemon *Daemon) getIpcContainer(container *container.Container) (*containe
|
||||||
if !c.IsRunning() {
|
if !c.IsRunning() {
|
||||||
return nil, derr.ErrorCodeIPCRunning.WithArgs(containerID)
|
return nil, derr.ErrorCodeIPCRunning.WithArgs(containerID)
|
||||||
}
|
}
|
||||||
|
if c.IsRestarting() {
|
||||||
|
return nil, derr.ErrorCodeContainerRestarting.WithArgs(containerID)
|
||||||
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,6 +992,9 @@ func (daemon *Daemon) getNetworkedContainer(containerID, connectedContainerID st
|
||||||
if !nc.IsRunning() {
|
if !nc.IsRunning() {
|
||||||
return nil, derr.ErrorCodeJoinRunning.WithArgs(connectedContainerID)
|
return nil, derr.ErrorCodeJoinRunning.WithArgs(connectedContainerID)
|
||||||
}
|
}
|
||||||
|
if nc.IsRestarting() {
|
||||||
|
return nil, derr.ErrorCodeContainerRestarting.WithArgs(connectedContainerID)
|
||||||
|
}
|
||||||
return nc, nil
|
return nc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,12 +226,12 @@ var (
|
||||||
})
|
})
|
||||||
|
|
||||||
// ErrorCodeIPCRunning is generated when we try to join a container's
|
// ErrorCodeIPCRunning is generated when we try to join a container's
|
||||||
// IPC but its not running.
|
// IPC but it's not running.
|
||||||
ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||||
Value: "IPCRUNNING",
|
Value: "IPCRUNNING",
|
||||||
Message: "cannot join IPC of a non running container: %s",
|
Message: "cannot join IPC of a non running container: %s",
|
||||||
Description: "An attempt was made to join the IPC of a container, but the container is not running",
|
Description: "An attempt was made to join the IPC of a container, but the container is not running",
|
||||||
HTTPStatusCode: http.StatusInternalServerError,
|
HTTPStatusCode: http.StatusConflict,
|
||||||
})
|
})
|
||||||
|
|
||||||
// ErrorCodeNotADir is generated when we try to create a directory
|
// ErrorCodeNotADir is generated when we try to create a directory
|
||||||
|
@ -265,7 +265,7 @@ var (
|
||||||
Value: "JOINRUNNING",
|
Value: "JOINRUNNING",
|
||||||
Message: "cannot join network of a non running container: %s",
|
Message: "cannot join network of a non running container: %s",
|
||||||
Description: "An attempt to join the network of a container, but that container isn't running",
|
Description: "An attempt to join the network of a container, but that container isn't running",
|
||||||
HTTPStatusCode: http.StatusInternalServerError,
|
HTTPStatusCode: http.StatusConflict,
|
||||||
})
|
})
|
||||||
|
|
||||||
// ErrorCodeModeNotContainer is generated when we try to network to
|
// ErrorCodeModeNotContainer is generated when we try to network to
|
||||||
|
|
Loading…
Reference in New Issue