... | ... |
@@ -1762,10 +1762,11 @@ func parseRun(cmd *flag.FlagSet, args []string, capabilities *Capabilities) (*Co |
1762 | 1762 |
_ = cmd.Bool("sig-proxy", true, "Proxify all received signal to the process (even in non-tty mode)") |
1763 | 1763 |
_ = cmd.String("name", "", "Assign a name to the container") |
1764 | 1764 |
) |
1765 |
+ |
|
1765 | 1766 |
cmd.Var(flAttach, "a", "Attach to stdin, stdout or stderr.") |
1766 | 1767 |
cmd.Var(flVolumes, "v", "Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)") |
1767 | 1768 |
|
1768 |
- cmd.Var(&flPublish, "p", "Publish a container's port to the host (use 'docker port' to see the actual mapping)") |
|
1769 |
+ cmd.Var(&flPublish, "p", fmt.Sprintf("Publish a container's port to the host (format: %s) (use 'docker port' to see the actual mapping)", PortSpecTemplateFormat)) |
|
1769 | 1770 |
cmd.Var(&flExpose, "expose", "Expose a port from the container without publishing it to your host") |
1770 | 1771 |
cmd.Var(&flEnv, "e", "Set environment variables") |
1771 | 1772 |
cmd.Var(&flDns, "dns", "Set custom dns servers") |
... | ... |
@@ -206,6 +206,12 @@ func parseLxcOpt(opt string) (string, string, error) { |
206 | 206 |
return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), nil |
207 | 207 |
} |
208 | 208 |
|
209 |
+// FIXME: network related stuff (including parsing) should be grouped in network file |
|
210 |
+const ( |
|
211 |
+ PortSpecTemplate = "ip:hostPort:containerPort" |
|
212 |
+ PortSpecTemplateFormat = "ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort" |
|
213 |
+) |
|
214 |
+ |
|
209 | 215 |
// We will receive port specs in the format of ip:public:private/proto and these need to be |
210 | 216 |
// parsed in the internal types |
211 | 217 |
func parsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding, error) { |
... | ... |
@@ -227,7 +233,7 @@ func parsePortSpecs(ports []string) (map[Port]struct{}, map[Port][]PortBinding, |
227 | 227 |
rawPort = fmt.Sprintf(":%s", rawPort) |
228 | 228 |
} |
229 | 229 |
|
230 |
- parts, err := utils.PartParser("ip:hostPort:containerPort", rawPort) |
|
230 |
+ parts, err := utils.PartParser(PortSpecTemplate, rawPort) |
|
231 | 231 |
if err != nil { |
232 | 232 |
return nil, nil, err |
233 | 233 |
} |