[proxy] Handle case where no command is specified.

The docker daemon can't do this because we set /w/w.
This commit is contained in:
Paul Bellamy committed 2015-08-04 12:32:42 +01:00
1 parent 78e0e79b26
commit 7cc53c4c68
3 files changed
+22 -6

No files matched your search

+9
View File
@@ -3,6 +3,7 @@ package proxy
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
@@ -15,6 +16,10 @@ import (
const MaxDockerHostname = 64
var (
ErrNoCommandSpecified = errors.New("No command specified")
)
type createContainerInterceptor struct{ proxy *Proxy }
type createContainerRequestBody struct {
@@ -105,6 +110,10 @@ func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Co
}
}
if len(container.Entrypoint) == 0 && len(container.Cmd) == 0 {
return ErrNoCommandSpecified
}
if len(container.Entrypoint) == 0 || container.Entrypoint[0] != weaveWaitEntrypoint[0] {
container.Entrypoint = append(weaveWaitEntrypoint, container.Entrypoint...)
}