How to publish a series of ports with "mode = host" with a Docker Compose file?

In the Docker Compose file, I can easily publish a number of ports using short form syntax:

ports: - "3000-3010:3000-3010/udp" 

But in my case, I need these ports as "mode = host" to bypass the swarm overlay network. Short form syntax cannot express this, so I need to use long-form:

 ports: - published: "3000-3010" target: "3000-3010" protocol: udp mode: host 

However, it seems that Docker does not like to specify ranges with long-form syntax, as I get this error when deploying the stack:

services.test.ports.0.target must be an integer

Is there a way to do this (other than brute force, specifying each port in the range as long-form)?

+7
docker docker-compose docker-swarm
source share
1 answer

This is currently not possible.

According to my discussion of this feature on the official slacker docker channel, access to a range of ports using long format syntax (which is the only syntax that can now be used to publish ports in host mode) is not possible.

Bearing in mind that there is an open ticke t related to this issue, I assume that it will be possible in the near future.

+4
source share

All Articles