You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/_includes/docker.md
+61-3
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,66 @@ Since Summon has pluggable providers, you aren't locked into any one solution fo
16
16
managing your secrets.
17
17
18
18
Summon makes it easy to inject secrets as environment variables into your Docker
19
-
containers by taking advantage of Docker's `--env-file` argument. This is done
20
-
on-demand by using the variable `@SUMMONENVFILE` in the arguments of the process
19
+
containers by taking advantage of Docker's CLI arguments (`--env-file` or, `--env` and `--volume`. There are two options available. It's possible to mix and match as you see fit.
20
+
21
+
## --env and --volume arguments
22
+
This is done on-demand by using the variable `@SUMMONDOCKERARGS` in the arguments of the process
23
+
you are running with Summon. This variable is replaced by combinations of the Docker arguments `--env` and `--volume` such that the secrets injected by summon are passed into the Docker container. The `--volume` arguments allow memory-mapped temporary files from variables with the `!file` tag to be resolvable inside the container.
24
+
25
+
**NOTE:** Using the `!file` tag with `@SUMMONDOCKERARGS` assumes that the Docker CLI is being run on the host that is used to create volume mounts to the container. For when this is not the case simply avoid using the `!file` tag, but be mindful that in that case you lose the benefits of memory-mapped temporary files.
26
+
27
+
```bash
28
+
$ summon -p keyring.py -D env=dev docker run @SUMMONDOCKERARGS deployer
29
+
Checking credentials
30
+
Deploying application
31
+
```
32
+
33
+
### Example
34
+
The example below demonstrates the use @SUMMONDOCKERARGS. For the sake of brevity
35
+
we use an inline `secrets.yml` and the `/bin/echo` provider. Some points to note:
36
+
1.`summon` is
37
+
invoking docker as the child process.
38
+
2.`@SUMMONDOCKERARGS` is replaced with a combination of `--env` and `--volume`
39
+
arguments.
40
+
3. Variable `D` uses the `!file` tag and therefore is the only one that
41
+
results in a `--volume` argument. The path to this variable inside the container
42
+
is as it is on the host.
43
+
44
+
```bash
45
+
secretsyml='
46
+
A: |-
47
+
A_value with
48
+
multiple lines
49
+
B: B_value
50
+
C: !var C_value
51
+
D: !var:file D_value
52
+
'
53
+
54
+
# The substitution of @SUMMONDOCKERARGS the docker run command below results in
55
+
# something of the form:
56
+
#
57
+
# docker run --rm \
58
+
# --env A --env B --env C --env D \
59
+
# --volume /path/to/D:/path/to/D
60
+
# alpine ...
61
+
#
62
+
# The output from the command is shown below the command.
0 commit comments