UCP provides an HTTP routing mesh, that extends the networking capabilities of Docker Engine. Docker Engine provides load balancing and service discovery at the transport layer for TCP and UDP connections. UCP’s HTTP routing mesh allows you to extend service discovery to have name-based virtual hosting for HTTP services.
See the Docker Engine documentation on overlay networks for more information on what Docker Engine provides.
This feature is currently experimental.
To enable the HTTP routing mesh, go to the UCP web UI, navigate to the Settings page, and click the Routing Mesh tab.
The default port for HTTP services is 80. You may choose an alternate port on this screen.
Check the checkbox to enable the HTTP routing mesh. This will create a service
ucp-hrm and a network called
The HTTP routing mesh can route to a Docker service that runs a webserver. This service must meet three criteria:
com.docker.ucp.mesh.httplabel to specify the ports to route
The syntax for the
com.docker.ucp.mesh.http label is a list of one or more
values separated by commas. Each of these values is in the form of
internal_portis the port the service is listening on (and may be omitted if there is only one port published)
hostis the hostname that should be routed to this service
A service based on the image
myimage/mywebserver:latest with a webserver running on port
8080 can be routed to
http://foo.example.com can be created using the
$ docker service create \ -p 8080 \ --network ucp-hrm \ --label com.docker.ucp.mesh.http=8080=http://foo.example.com \ --name myservice \ myimage/mywebserver:latest
The HTTP Routing Mesh checks for new services every 60 seconds, so it may take up to one minute for configuration to complete.
Next, you will need to route the referenced domains to the HTTP routing mesh.
The HTTP routing mesh uses the
Host HTTP header to determine which service
should receive a particular HTTP request. This is typically done using DNS and
pointing one or more domains to one or more nodes in the UCP cluster.
To disable the HTTP routing mesh, first ensure that all services that are using the HTTP routing mesh are disconnected from the ucp-hrm network.
Next, go to the UCP web UI, navigate to the Settings page, and click the Routing Mesh tab. Uncheck the checkbox to disable the HTTP routing mesh.
To route a domain to the HTTP Routing Mesh, the service must be on the
ucp-hrm network which has the
ucp-hrm access label. Adding a service to
this network either requires administrator-level access, or the user must be in
a group that gives them
Check the logs of the
ucp-controller containers on your UCP controller nodes
for logging from the HTTP routing mesh.