Links and exposed services address communication across container services and load balancing across hosts. You can configure link settings for your containers in Containers.

About this task

You can use links to enable communication between multiple services in your application. Links in Containers are similar to Docker links, but connect containers across hosts. A link consists of two parts: a service name and an alias. The service name is the name of the service or template being called. The alias is the host name that you use to communicate with that service.

For example, if you have an application that contains a Web and database service and you define a link in the Web service to the database service by using an alias of my-db, the Web service application opens a TCP connection to my-db:{PORT_OF_DB}. The PORT_OF_DB is the port that the database listens to, regardless of the public port that is assigned to the host by the container settings. If MySQL is checking for updates on its default port of 3306, and the published port for the container host is 32799, the Web application accesses the database at my-db:3306 .

Note:

It is recommended that you use networks instead of links. Links are now a legacy Docker feature with significant limitations when linking container clusters, including:

  • Docker does not support multiple links with the same alias. It is recommended that you allow Containers for vRealize Automation to generate link aliases for you.

  • You cannot update the links of a container runtime. When scaling up or down a linked cluster, the dependent container’s links will not be updated.

Prerequisites

  • Verify that Containers for vRealize Automation is enabled in your supported vRealize Automation deployment.

  • Verify that you have container administrator or container architect role privileges.

  • Verify that a bridge network is available for linking services.

  • Verify that the internal port of the target service is published. For cross communication, the service can be mapped to any other port but must be accessible from outside the host.

  • Verify that the service hosts are able to access each other.

Procedure

  1. Log in to vRealize Automation.
  2. Click the Containers tab.
  3. Click Templates in the left pane.
  4. Edit the template or image.
  5. To edit a template
    1. Click Edit in the upper-right section of the template that you want to open.
    2. If the template contains multiple templates, point to the template that you want to edit, and click Edit in the upper-right section of the template that you want to open.
  6. To edit an image.
    1. Click the arrow next to the image's Provision button, and click Enter additional info.

    The Provision a Container or Edit Container Definition page appears, providing access to categorized sets of editable properties and settings.

  7. Click the Basic tab.
  8. In the Services text box, enter a comma-separated list of services that the container is dependant on.
  9. In the Alias text box, enter a descriptive name for the service or comma-separated list of services.
  10. Click Save.