From 1f850d41dab7c0251b848b0cb5973af91d09ba14 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Fri, 19 Aug 2016 01:00:21 +0900 Subject: [PATCH] driver.rkt: add documentation about Networking --- website/source/docs/drivers/rkt.html.md | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/website/source/docs/drivers/rkt.html.md b/website/source/docs/drivers/rkt.html.md index 2056c76bc..34a916b9e 100644 --- a/website/source/docs/drivers/rkt.html.md +++ b/website/source/docs/drivers/rkt.html.md @@ -73,6 +73,19 @@ The `rkt` driver supports the following configuration in the job spec: * `dns_search_domains` - (Optional) A list of DNS search domains to be used in the containers. +* `net` - (Optional) A list of networks to be used by the containers + +* `port_map` - (Optional) A key/value map of port to be used by the container. + port name in the image manifest file needs to be specified for the value. For example: + + ``` + port_map { + app = "8080-tcp" + } + ``` + + See below for more details. + * `debug` - (Optional) Enable rkt command debug option. * `volumes` - (Optional) A list of `host_path:container_path` strings to bind @@ -84,6 +97,50 @@ The `rkt` driver supports the following configuration in the job spec: } ``` +## Networking + +The `rkt` can specify `--net` and `--port` for the rkt client. Hence, there are two ways to use host ports by +using `--net=host` or `--port=PORT` with your network. + +Example: + +``` + task "etcd" { + # Use Docker to run the task. + driver = "rkt" + + config { + image = "docker://my_image" + net = ["containers"] + port_map { + app = "8080-tcp" + } + } + + service { + port = "app" + } + + resources { + network { + mbits = 10 + port "app" { + static = 12345 + } + } + } + } + +``` + +### Allocating Ports + +You can allocate ports to your task using the port syntax described on the +[networking page](/docs/jobspec/networking.html). + +When you use port allocation, the image manifest needs to declare public ports and host has configured network. +For more information, please refer to [rkt Networking](https://coreos.com/rkt/docs/latest/networking/overview.html). + ## Client Requirements The `rkt` driver requires rkt to be installed and in your system's `$PATH`.