Artificial intelligent assistant

How to access Docker Swarm service from outside the cluster? If there is a web app running in my cluster, how do I access it from an external client? Do I need a reverse proxy or is there a "swarm way" of doing this?

When you create your service you need to use the `--publish` option.

E.g.:


docker service create --detach=true --replicas 3 --publish 80:80 --name httpd httpd


Now port 80 is exposed to the main network. Usefully, _every_ server in the swarm publishes port 80 and will do an internal redirect to wherever the container is actually running.

Similarly, if you use a stack then you use the `ports` option. E.g.:


services:
web:
image: httpd
ports:
- 80:80

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 259e6210c784b5fa19a99b4efde5a430