Do Itoa once so line items are simpler
This commit is contained in:
parent
3b7c252090
commit
43aaf94383
|
@ -272,14 +272,15 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, dri
|
||||||
exposedPorts := map[docker.Port]struct{}{}
|
exposedPorts := map[docker.Port]struct{}{}
|
||||||
|
|
||||||
for _, port := range network.ReservedPorts {
|
for _, port := range network.ReservedPorts {
|
||||||
portStr := docker.Port(port.Value)
|
hostPortStr := strconv.Itoa(port.Value)
|
||||||
|
dockerPort := docker.Port(hostPortStr)
|
||||||
|
|
||||||
publishedPorts[portStr+"/tcp"] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: strconv.Itoa(port.Value)}}
|
publishedPorts[dockerPort+"/tcp"] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: hostPortStr}}
|
||||||
publishedPorts[portStr+"/udp"] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: strconv.Itoa(port.Value)}}
|
publishedPorts[dockerPort+"/udp"] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: hostPortStr}}
|
||||||
d.logger.Printf("[DEBUG] driver.docker: allocated port %s:%d -> %d (static)\n", network.IP, port.Value, port.Value)
|
d.logger.Printf("[DEBUG] driver.docker: allocated port %s:%d -> %d (static)\n", network.IP, port.Value, port.Value)
|
||||||
|
|
||||||
exposedPorts[portStr+"/tcp"] = struct{}{}
|
exposedPorts[dockerPort+"/tcp"] = struct{}{}
|
||||||
exposedPorts[portStr+"/udp"] = struct{}{}
|
exposedPorts[dockerPort+"/udp"] = struct{}{}
|
||||||
d.logger.Printf("[DEBUG] driver.docker: exposed port %d\n", port.Value)
|
d.logger.Printf("[DEBUG] driver.docker: exposed port %d\n", port.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue