edit-icon download-icon

external

Last Updated: Feb 12, 2018

Template version

Compose V1/V2 Compose V3
external_links in Compose. Not supported.

Compose V1/V2

Set a service to directly link to an external address.

Under the extension field, the following fields can be used:

  • host: Set the domain name of the link.
  • ports: Set the port of the link.

Orchestration example:

Directly start a MySQL container without using the external label.

  1. web:
  2. image: wordpress:4.2
  3. ports:
  4. - 80
  5. links:
  6. - db:mysql
  7. db:
  8. image: 10.32.161.160:5000/mysql
  9. environment:
  10. - MYSQL_ROOT_PASSWORD=password

Use the external label to describe an RDS service that is not deployed in the cluster and provide the service to the WordPress deployed in the cluster for use.

  1. WordPress:
  2. image: wordpress:4.2
  3. ports:
  4. - 80
  5. links:
  6. - db:mysql
  7. environment:
  8. - WORDPRESS_DB_USER=cloud
  9. - WORDPRESS_DB_PASSWORD=MYPASSWORD
  10. - WORDPRESS_DB_NAME=wordpress
  11. db:
  12. external:
  13. host: rdsxxxx.mysql.rds.aliyuncs.com
  14. ports:
  15. - 3306
Thank you! We've received your feedback.