title: Docker-Compose: Expose range ports to host while scale containers
body: <p>I am using a docker-compose file and I need to scale specific containers by using the command</p>
  
  <pre><code>docker-compose scale taskcontainer=3
  </code></pre>
  
  <p>Unfortunately this is not possible due to the fact that I need to expose a specific port from all internal containers and I need a port range on host to make it happen. For example consider the following snippet</p>
  
  <pre><code>  taskcontainer:
      image: custom-container
      ports:
        - "9251:9249"
  </code></pre>
  
  <p>when I scale to 3 containers I need to export port 9249 from internal containers to 3 ports on host e.g. 9251-9253 (to avoid port clash on host) and I need that functionality dynamically because I do not know in advance how many containers will be used for scaling.</p>
  
  <p>Is there a way to achieve that functionality?</p>