diff --git a/container.go b/container.go index 684d23856..8e5c4278e 100644 --- a/container.go +++ b/container.go @@ -23,6 +23,7 @@ var ( ErrNoRunningTask = errors.New("no running task") ErrDeleteRunningTask = errors.New("cannot delete container with running task") ErrProcessExited = errors.New("process already exited") + ErrNoExecID = errors.New("exec id must be provided") ) type DeleteOpts func(context.Context, *Client, containers.Container) error diff --git a/task.go b/task.go index 03305eb20..262678f65 100644 --- a/task.go +++ b/task.go @@ -191,6 +191,9 @@ func (t *task) Delete(ctx context.Context) (uint32, error) { } func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) { + if id == "" { + return nil, ErrNoExecID + } i, err := ioCreate() if err != nil { return nil, err