mirror of
https://github.com/docker/cli.git
synced 2026-09-26 01:10:35 -04:00
Add error checking for hostPort range
This fix catches the case where there is a single container port
and a dynamic host port and will fail out gracefully
Example docker-compose.yml snippet:
port:
ports:
- "8091-8093:8091"
- "80:8080"
Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
Upstream-commit: 74c29fde04
Component: cli
This commit is contained in:
@@ -301,9 +301,11 @@ func convertEndpointSpec(source []string) (*swarm.EndpointSpec, error) {
|
||||
}
|
||||
|
||||
for port := range ports {
|
||||
portConfigs = append(
|
||||
portConfigs,
|
||||
opts.ConvertPortToPortConfig(port, portBindings)...)
|
||||
portConfig, err := opts.ConvertPortToPortConfig(port, portBindings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
portConfigs = append(portConfigs, portConfig...)
|
||||
}
|
||||
|
||||
return &swarm.EndpointSpec{Ports: portConfigs}, nil
|
||||
|
||||
Reference in New Issue
Block a user