Improve error for docker exec & LXC
| ... | ... |
@@ -6,9 +6,11 @@ import ( |
| 6 | 6 |
"fmt" |
| 7 | 7 |
"io" |
| 8 | 8 |
"io/ioutil" |
| 9 |
+ "strings" |
|
| 9 | 10 |
"sync" |
| 10 | 11 |
|
| 11 | 12 |
"github.com/docker/docker/daemon/execdriver" |
| 13 |
+ "github.com/docker/docker/daemon/execdriver/lxc" |
|
| 12 | 14 |
"github.com/docker/docker/engine" |
| 13 | 15 |
"github.com/docker/docker/pkg/broadcastwriter" |
| 14 | 16 |
"github.com/docker/docker/pkg/ioutils" |
| ... | ... |
@@ -103,6 +105,10 @@ func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status {
|
| 103 | 103 |
return job.Errorf("Usage: %s [options] container command [args]", job.Name)
|
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 |
+ if strings.HasPrefix(d.execDriver.Name(), lxc.DriverName) {
|
|
| 107 |
+ return job.Error(lxc.ErrExec) |
|
| 108 |
+ } |
|
| 109 |
+ |
|
| 106 | 110 |
var name = job.Args[0] |
| 107 | 111 |
|
| 108 | 112 |
container, err := d.getActiveContainer(name) |
| ... | ... |
@@ -2,6 +2,7 @@ package lxc |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 |
+ "errors" |
|
| 5 | 6 |
"fmt" |
| 6 | 7 |
"io" |
| 7 | 8 |
"io/ioutil" |
| ... | ... |
@@ -27,6 +28,8 @@ import ( |
| 27 | 27 |
|
| 28 | 28 |
const DriverName = "lxc" |
| 29 | 29 |
|
| 30 |
+var ErrExec = errors.New("Unsupported: Exec is not supported by the lxc driver")
|
|
| 31 |
+ |
|
| 30 | 32 |
type driver struct {
|
| 31 | 33 |
root string // root path for the driver to use |
| 32 | 34 |
initPath string |
| ... | ... |
@@ -534,5 +537,5 @@ func (t *TtyConsole) Close() error {
|
| 534 | 534 |
} |
| 535 | 535 |
|
| 536 | 536 |
func (d *driver) Exec(c *execdriver.Command, processConfig *execdriver.ProcessConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
|
| 537 |
- return -1, fmt.Errorf("Unsupported: Exec is not supported by the lxc driver")
|
|
| 537 |
+ return -1, ErrExec |
|
| 538 | 538 |
} |