[proxy] Handle null HostConfigs gracefully in start
This commit is contained in:
1 parent
725f99ea4c
commit
c24dc6609d
3 files changed
+6
-2
No files matched your search
@@ -24,7 +24,7 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
|
||||
}
|
||||
|
||||
hostConfig := &docker.HostConfig{}
|
||||
if err := unmarshalRequestBody(r, &hostConfig); err != nil {
|
||||
if err := unmarshalRequestBody(r, hostConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -18,4 +18,8 @@ proxy docker_on $HOST1 create --name=c3 -v /tmp:/hosttmp $SMALL_IMAGE $CHECK_ETH
|
||||
proxy docker_api_on $HOST1 POST /containers/c3/start '{"Binds":[],"Dns":null,"DnsSearch":null,"ExtraHosts":null,"VolumesFrom":null,"Devices":null,"NetworkMode":""}'
|
||||
assert "docker_on $HOST1 inspect -f '{{.State.Running}} {{.State.ExitCode}} {{.HostConfig.Dns}}' c3" "false 0 [$docker_bridge_ip]"
|
||||
|
||||
# Start c4 with an 'null' HostConfig
|
||||
proxy docker_on $HOST1 create --name=c4 $SMALL_IMAGE echo foo
|
||||
assert_raises "proxy docker_api_on $HOST1 POST /containers/c4/start 'null'"
|
||||
|
||||
end_suite
|
||||
+1
-1
@@ -106,7 +106,7 @@ docker_api_on() {
|
||||
data=$4
|
||||
shift 4
|
||||
[ -z "$DEBUG" ] || greyly echo "Docker (API) on $host:$DOCKER_PORT: $method $url" >&2
|
||||
echo -n "$data" | curl -s -X "$method" -H Content-Type:application/json "http://$host:$DOCKER_PORT/v1.15$url" -d @-
|
||||
echo -n "$data" | curl -s -f -X "$method" -H Content-Type:application/json "http://$host:$DOCKER_PORT/v1.15$url" -d @-
|
||||
}
|
||||
|
||||
proxy() {
|
||||
|
||||
Reference in new issue
Block a user