Home > database >  Hashicorp Vault container don't save my secrets on local volume when I restart docker compose
Hashicorp Vault container don't save my secrets on local volume when I restart docker compose

Time:07-14

To be brief I'm struggling persisting the data saved in a vault container in my local machine after I put a docker-compose down and re-deploy it with docker-compose up -d, the data is lost. I'll show you how my .yml looks like very simple:

version: '3.7'

services:
  vault_dev:
      image: vault:latest
      volumes:
        - vault-file:/vault/file
      ports:
        - "8200:8200/tcp"
      environment:
        VAULT_DEV_ROOT_TOKEN_ID: 'root'
        VAULT_DEV_LISTEN_ADDRESS: '0.0.0.0:8200'
      cap_add:
        - IPC_LOCK
      container_name: vault_dev
      entrypoint: "vault server -dev"

volumes:
     vault-file: {}

CodePudding user response:

When Vault is started with the -dev option it stores secrets in memory only. They are lost when it shuts down. Nothing to do with Docker.

You probably want to remove the -dev option in your Dockerfile entrypoint and use file storage option in your configuration file.

  • Related