https://github.com/voronenko/docker_vault
Minimal vault container for unit testing
https://github.com/voronenko/docker_vault
Last synced: about 1 year ago
JSON representation
Minimal vault container for unit testing
- Host: GitHub
- URL: https://github.com/voronenko/docker_vault
- Owner: Voronenko
- Created: 2016-08-06T18:35:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T11:01:37.000Z (almost 8 years ago)
- Last Synced: 2025-04-15T01:16:02.768Z (about 1 year ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Docker Vault for automated testing https://github.com/Voronenko/hashi_vault_utils
This Docker Vault container is using [Alpine Linux](https://hub.docker.com/_/alpine/) minimal image and [Hashicorp's Vault](https://vaultproject.io/).
The latest build is always available at [voronenko/vault](https://registry.hub.docker.com/u/voronenko/vault/):
`docker pull voronenko/vault`
### Starting dev server
Start vault server in a **dev mode**:
```
docker run -d \
-p 8200:8200 \
--hostname vault \
--name vault voronenko/vault
```
by default ROOT_TOKEN will be abfd0e04-7922-6850-e1bd-f02c325f1e2c
you can change it by passing environment variable EXTERNAL_VAULT_TOKEN to container.
It is recommended to export this token as environment variable VAULT_TOKEN too.
To initialize Vault, on your workstation with `vault` installed, first we need to export vault ip address.
Use `docker inspect -f '{{ .NetworkSettings.IPAddress }}' vault` command to get the vault container internal ip address.
You should export this address as VAULT_ADDR
```
# The address must start with protocol specifier!
export VAULT_ADDR='http://a.b.c.d:8200'
```
Note: this is dev vault image, thus the empty initialized and unsealed **inmem** vault data store will be automatically created each run.
To use a vault client from a container you can create a wrapper function like bellow:
```
vault () { docker run -it --rm -e VAULT_ADDR --entrypoint=/bin/sh voronenko/vault -c "vault auth $VAULT_TOKEN &>/dev/null; vault $*" }
```