Reputation: 71
I am trying to use Vault in a Spring Boot app and created the following docker-compose and vault.json files.
version: '3.8'
services:
vault:
container_name: vault
image: vault
restart: always
environment:
VAULT_ADDR: http://127.0.0.1:8200
entrypoint: vault server -config=/vault.json
ports:
- '8200:8200'
volumes:
- ./volumes/logs:/vault/logs
- ./volumes/file:/vault/file
- ./volumes/config:/vault/config
cap_add:
- IPC_LOCK
{
"backend": {
"file": {
"path": "/vault/file"
}
},
"listener": {
"tcp": {
"address": "0.0.0.0:8200",
"tls_disable": 1
}
},
"ui": true,
"disable_mlock": true
}
And keep them in the same directory and try to run the following command in this directory using bash
and cmd
:
docker-compose up --build
But it gives the following message and error:
[+] Running 1/1 Container vault Recreated 0.1s Attaching to vault vault | error loading configuration from vault.json: stat vault.json: no such file or directory
I tried many combination on the entrypoint: vault server -config=/vault.json
line, but still the same problem. How to solve it?
Upvotes: 0
Views: 1733
Reputation: 1
add your vault.json to /volumes/config/, for example if your docker-compose.yaml in /Users/java/vault - add it to /Users/java/vault/volumes/config/
Upvotes: 0
Reputation: 1689
You need to add vault.json
in volume
section.
volumes:
- ./vault.json:/vault.json
Your compose file should change to this:
version: '3.8'
services:
vault:
container_name: vault
image: vault
restart: always
environment:
VAULT_ADDR: http://127.0.0.1:8200
entrypoint: vault server -config=/vault.json
ports:
- '8200:8200'
volumes:
- ./volumes/logs:/vault/logs
- ./volumes/file:/vault/file
- ./volumes/config:/vault/config
- ./vault.json:/vault.json
cap_add:
- IPC_LOCK
Upvotes: 0