mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #8191 from vieux/improve_error_exec_lxc
Improve error for docker exec & LXC
This commit is contained in:
commit
0913009ebe
2 changed files with 10 additions and 1 deletions
|
@ -6,9 +6,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/execdriver"
|
"github.com/docker/docker/daemon/execdriver"
|
||||||
|
"github.com/docker/docker/daemon/execdriver/lxc"
|
||||||
"github.com/docker/docker/engine"
|
"github.com/docker/docker/engine"
|
||||||
"github.com/docker/docker/pkg/broadcastwriter"
|
"github.com/docker/docker/pkg/broadcastwriter"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
|
@ -103,6 +105,10 @@ func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status {
|
||||||
return job.Errorf("Usage: %s [options] container command [args]", job.Name)
|
return job.Errorf("Usage: %s [options] container command [args]", job.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(d.execDriver.Name(), lxc.DriverName) {
|
||||||
|
return job.Error(lxc.ErrExec)
|
||||||
|
}
|
||||||
|
|
||||||
var name = job.Args[0]
|
var name = job.Args[0]
|
||||||
|
|
||||||
container, err := d.getActiveContainer(name)
|
container, err := d.getActiveContainer(name)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package lxc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -27,6 +28,8 @@ import (
|
||||||
|
|
||||||
const DriverName = "lxc"
|
const DriverName = "lxc"
|
||||||
|
|
||||||
|
var ErrExec = errors.New("Unsupported: Exec is not supported by the lxc driver")
|
||||||
|
|
||||||
type driver struct {
|
type driver struct {
|
||||||
root string // root path for the driver to use
|
root string // root path for the driver to use
|
||||||
initPath string
|
initPath string
|
||||||
|
@ -534,5 +537,5 @@ func (t *TtyConsole) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
|
func (d *driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
|
||||||
return -1, fmt.Errorf("Unsupported: Exec is not supported by the lxc driver")
|
return -1, ErrExec
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue