$ docker service create --name dns-cache \
--publish published=53,target=53 \
dns-cache
```
Short syntax:
```console
$ docker service create --name dns-cache \
-p 53:53 \
dns-cache
```
#### TCP and UDP
Long syntax:
```console
$ docker service create --name dns-cache \
--publish published=53,target=53 \
--publish published=53,target=53,protocol=udp \
dns-cache
```
Short syntax:
```console
$ docker service create --name dns-cache \
-p 53:53 \
-p 53:53/udp \
dns-cache
```
#### UDP only
Long syntax:
```console
$ docker service create --name dns-cache \
--publish published=53,target=53,protocol=udp \
dns-cache
```
Short syntax:
```console
$ docker service create --name dns-cache \
-p 53:53/udp \
dns-cache
```
## Bypass the routing mesh
By default, swarm services which publish ports do so using the routing mesh.
When you connect to a published port on any swarm node (whether it is running a
given service or not), you are redirected to a worker which is running that
service, transparently. Effectively, Docker acts as a load balancer for your
swarm services.
You can bypass the routing mesh, so that when you access the bound port on a
given node, you are always accessing the instance of the service running on
that node. This is referred to as `host` mode. There are a few things to keep
in mind.
- If you access a node which is not running a service task, the service does not
listen on that port. It is possible that nothing is listening, or
that a completely different application is listening.
- If you expect to run multiple service tasks on each node (such as when you
have 5 nodes but run 10 replicas), you cannot specify a static target port.
Either allow Docker to assign a random high-numbered port (by leaving off the
`published`), or ensure that only a single instance of the service runs on a
given node, by using a global service rather than a replicated one, or by
using placement constraints.
To bypass the routing mesh, you must use the long `--publish` service and
set `mode` to `host`. If you omit the `mode` key or set it to `ingress`, the
routing mesh is used. The following command creates a global service using
`host` mode and bypassing the routing mesh.
```console
$ docker service create --name dns-cache \
--publish published=53,target=53,protocol=udp,mode=host \
--mode global \
dns-cache
```
## Configure an external load balancer
You can configure an external load balancer for swarm services, either in
combination with the routing mesh or without using the routing mesh at all.
### Using the routing mesh
You can configure an external load balancer to route requests to a swarm
service. For example, you could configure [HAProxy](https://www.haproxy.org) to
balance requests to an nginx service published to port 8080.