Browse code

Added documentation

Signed-off-by: Vladimir Pouzanov <farcaller@google.com>

Vladimir Pouzanov authored on 2016/07/14 06:49:40
Showing 1 changed files
... ...
@@ -37,6 +37,10 @@ The `--gcp-project` takes precedence over information discovered from the metada
37 37
 so a Docker daemon running in a Google Cloud Project can be overridden to log to a different
38 38
 Google Cloud Project using `--gcp-project`.
39 39
 
40
+Docker fetches the values for zone, instance name and instance id from Google
41
+Cloud metadata server. Those values can be provided via options if metadata
42
+server is not available. They will not override the values from metadata server.
43
+
40 44
 ## gcplogs options
41 45
 
42 46
 You can use the `--log-opt NAME=VALUE` flag to specify these additional Google
... ...
@@ -48,6 +52,9 @@ Cloud Logging driver options:
48 48
 | `gcp-log-cmd`               | optional | Whether to log the command that the container was started with. Defaults to false.                                                          |
49 49
 | `labels`                    | optional | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container.                   |
50 50
 | `env`                       | optional | Comma-separated list of keys of environment variables, which should be included in message, if these variables are specified for container. |
51
+| `gcp-meta-zone`             | optional | Zone name for the instance. |
52
+| `gcp-meta-name`             | optional | Instance name. |
53
+| `gcp-meta-id`               | optional | Instance ID. |
51 54
 
52 55
 If there is collision between `label` and `env` keys, the value of the `env`
53 56
 takes precedence. Both options add additional fields to the attributes of a
... ...
@@ -57,13 +64,22 @@ Below is an example of the logging options required to log to the default
57 57
 logging destination which is discovered by querying the GCE metadata server.
58 58
 
59 59
     docker run --log-driver=gcplogs \
60
-        --log-opt labels=location
61
-        --log-opt env=TEST
62
-        --log-opt gcp-log-cmd=true
63
-        --env "TEST=false"
64
-        --label location=west
60
+        --log-opt labels=location \
61
+        --log-opt env=TEST \
62
+        --log-opt gcp-log-cmd=true \
63
+        --env "TEST=false" \
64
+        --label location=west \
65 65
         your/application
66 66
 
67 67
 This configuration also directs the driver to include in the payload the label
68 68
 `location`, the environment variable `ENV`, and the command used to start the
69 69
 container.
70
+
71
+An example of the logging options for running outside of GCE (the daemon must be
72
+configured with GOOGLE_APPLICATION_CREDENTIALS):
73
+
74
+    docker run --log-driver=gcplogs \
75
+        --log-opt gcp-project=test-project
76
+        --log-opt gcp-meta-zone=west1 \
77
+        --log-opt gcp-meta-name=`hostname` \
78
+        your/application