August 2017
Intermediate to advanced
332 pages
9h 16m
English
Docker services, similar to the containers, have a port forwarding mechanism. We use it by adding the -p <host_port>:<container:port> parameter. Here's what starting a service could look like:
$ docker service create --replicas 1 --publish 8080:8080 --name tomcat tomcat
Now, we can open a browser and see the Tomcat's main page under the address http://192.168.0.143:8080/.
The application is available on the manager host that acts as a load balancer and distributes requests to worker nodes. What may sound a little less intuitive is the fact that we can access Tomcat using the IP address of any worker, for example, if worker nodes are available under 192.168.0.166 and 192.168.0.115, we can access the same running container ...
Read now
Unlock full access