Will the new version of docker swarm in docker 1.12 support the -P, --publish-all option? If not how would I have my docker service containers get a random port when it needs one? As of right now all docker services I run will simply attach themselves to the port I assign with -p, for example -p 80:80 .
For reference here is the --help entry for -P, --publish-all in the last version of docker: -P, --publish-all Publish all exposed ports to random ports
For some reason I get an error message when trying to do this, here is my create command:
docker service create --replicas 1 --name apa-sim -p :80 cohenaj194/apache-simple
The container created has the following port configuration: PORTS 80/tcp
And here is the resulting error in the logs of the container created: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.255.0.8. Set the 'ServerName' directive globally to suppress this message
All of this works just fine when I do a regular docker run command.
I found the solution. docker services require a docker network to be reachable. Follow these two steps and the service nodes will work, heres how it would work with my service: