Skip to content

Commit bc78bcb

Browse files
theodiefenthalTheo Diefenthal
and
Theo Diefenthal
authored
Improve Hashicorp Vault docker run example for server mode (#2246)
* Improve Hashicorp Vault docker run example for server mode to actually be directly usable and fix backend to current wording of storage * Upgrade hashicorp vault readme by suggestions from mladlow making it explicit that docker run example is not meant for productional use Co-authored-by: Theo Diefenthal <theo@dtheo.de>
1 parent 114ea74 commit bc78bcb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

vault/content.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,24 @@ As an example:
4545
$ docker run --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -e 'VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:1234' %%IMAGE%%
4646
```
4747

48-
## Running Vault in Server Mode
48+
## Running Vault in Server Mode for Development
4949

5050
```console
51-
$ docker run --cap-add=IPC_LOCK -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/vault/file"}}, "default_lease_ttl": "168h", "max_lease_ttl": "720h"}' %%IMAGE%% server
51+
$ docker run --cap-add=IPC_LOCK -e 'VAULT_LOCAL_CONFIG={"storage": {"file": {"path": "/vault/file"}}, "listener": [{"tcp": { "address": "0.0.0.0:8200", "tls_disable": true}}], "default_lease_ttl": "168h", "max_lease_ttl": "720h", "ui": true}' -p 8200:8200 %%IMAGE%% server
5252
```
5353

54-
This runs a Vault server using the `file` storage backend at path `/vault/file`, with a default secret lease duration of one week and a maximum of 30 days.
54+
This runs a Vault server with TLS disabled, the `file` storage backend at path `/vault/file` and a default secret lease duration of one week and a maximum of 30 days. Disabling TLS and using the `file` storage backend are not recommended for production use.
5555

5656
Note the `--cap-add=IPC_LOCK`: this is required in order for Vault to lock memory, which prevents it from being swapped to disk. This is highly recommended. In a non-development environment, if you do not wish to use this functionality, you must add `"disable_mlock: true"` to the configuration information.
5757

5858
At startup, the server will read configuration HCL and JSON files from `/vault/config` (any information passed into `VAULT_LOCAL_CONFIG` is written into `local.json` in this directory and read as part of reading the directory for configuration files). Please see Vault's [configuration documentation](https://www.vaultproject.io/docs/config/index.html) for a full list of options.
5959

60+
We suggest volume mounting a directory into the Docker image in order to give both the configuration and TLS certificates to Vault. You can accomplish this with:
61+
62+
```console
63+
$ docker run --volume config/:/vault/config.d ...
64+
```
65+
66+
For more scalability and reliability, we suggest running containerized Vault in an orchestration environment like k8s or OpenShift.
67+
6068
Since 0.6.3 this container also supports the `VAULT_REDIRECT_INTERFACE` and `VAULT_CLUSTER_INTERFACE` environment variables. If set, the IP addresses used for the redirect and cluster addresses in Vault's configuration will be the address of the named interface inside the container (e.g. `eth0`).

0 commit comments

Comments
 (0)