title: Docker: give a random port mapping only to certain ports
body: <p>I'm using Docker 1.9.1's remote API to create a container.</p>
  
  <p>One thing I'm trying to accomplish is that among all the exposed ports of an image, I only want to expose a few of them (or in other words give them host port mapping), at the same time I don't want to manage the host ports to use but want Docker to pick up random and available ones.</p>
  
  <p>For example, an image has port 80, 443, 22 exposed, what I want is something like this in a Docker run flavor (I know this is not possible through cmd line though)</p>
  
  <p><code>docker run -p {a random available port}:80 image</code></p>
  
  <p>Can I achieve something like this through remote API? Right now I can only set <code>PublishAllPorts = true</code> but that publish all ports and waste too many host ports.</p>