e2acca67 |
package daemon
|
534a90a9 |
import ( |
cfdf84d5 |
"github.com/docker/docker/container" |
534a90a9 |
"golang.org/x/net/context"
) |
e2acca67 |
|
49211715 |
// ContainerWait waits until the given container is in a certain state
// indicated by the given condition. If the container is not found, a nil |
cfdf84d5 |
// channel and non-nil error is returned immediately. If the container is
// found, a status result will be sent on the returned channel once the wait
// condition is met or if an error occurs waiting for the container (such as a |
49211715 |
// context timeout or cancellation). On a successful wait, the exit code of the |
cfdf84d5 |
// container is returned in the status with a non-nil Err() value. |
49211715 |
func (daemon *Daemon) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error) {
cntr, err := daemon.GetContainer(name) |
534a90a9 |
if err != nil { |
cfdf84d5 |
return nil, err |
534a90a9 |
}
|
49211715 |
return cntr.Wait(ctx, condition), nil |
534a90a9 |
} |