[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:
1 parent
78e0e79b26
commit
7cc53c4c68
3 files changed
+22
-6
No files matched your search
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user