I have been attempting to run a docker service for a basic apache container. The issue is that, due to the weird networking of docker services I have no idea how to view my containers in a browser. Here is the command I am using to create my service.
docker service create --replicas 6 --name apa-sim -p 30000:80 cohenaj194/apache-simple
My containers do not get ports on the host machine assigned to them and are not visible from a browser. However as I have found, this is a default part of docker services. Somehow they are all assigned to some other address and docker automatically load balances between the instances that exist on any one machine. Thats cool, but I really just want to know how to view my containers in a browser?
Note that a docker service inspect --pretty apa-sim
gives the following output concerning the ports:
Ports:
Name =
Protocol = tcp
TargetPort = 80
PublishedPort = 30000
The only way to view my containers in a browser is if they run on -p 80:80
and then only one container can be viewed at a time. It does not load balance between the containers.