I'm working on an application that should get some secrets from Vault. I want the app to run on a container and the vault server on another one. However I'm having some issues putting things together with docker-compose.
services:
app:
image: app/progettinotoy
networks:
- mainnet
ports:
- 8080:8080
depends_on:
- "vault"
vault:
image: vault
cap_add:
- "IPC_LOCK"
networks:
- mainnet
ports:
- 8200:8200
environment:
VAULT_ADDR: http://127.0.0.1:8200
VAULT_LOCAL_CONFIG:
api_addr = "http://127.0.0.1:8200"
cluster_addr = "https://127.0.0.1:8201"
ui = true
backend "file" {
path = "/vault/file"
}
listener "tcp" {
address = "0.0.0.0:8200"
tls_disable = "true"
}
command:
- "server"
networks:
mainnet:
driver: bridge
The main reason is that even though vault server is running, I should execute vault operator init and get root token and unseal keys before application starts to interact with vault server.
How can i do that?