Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hashicorp vault ui is not accessible when running it through docker

I am trying to setup HashiCorp vault using docker. I am using MySql database for the storage. I created both MySql and Vault docker containers in same network using docker network.

config.hcl

ui = true

storage "mysql" {
  address = "localhost:3306"
  username = "root"
  password = "Test@12345"
  database = "vault"
}

listener "tcp" {
 address = "127.0.0.1:8200"
 tls_disable = "true"
 }

MySql Container:

docker run --name vault-mysql -e MYSQL_ROOT_PASSWORD=Test@12345 -d --network vault_network  mysql:latest

Vault Container:

docker run  -p 8200:8200 -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/Users/jaddap2/vault/config.hcl"}}, "default_lease_ttl": "168h", "max_lease_ttl": "720h"}'  \
 --cap-add=IPC_LOCK --network vault_network  vault server

When I try to access the vault using http://127.0.0.1:8200/ui I get the following error

vault error

like image 413
Pavan Jadda Avatar asked Sep 10 '25 16:09

Pavan Jadda


1 Answers

Vault Docker container runs in dev mode by default as per it's Dockerfile.

So, passing server argument won't make any different. You can simply run just vault. Then you'll be able to access the UI. But during the dev mode, it runs on memory.

docker run  -p 8200:8200 -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/tmp/config.hcl"}}, "default_lease_ttl": "168h", "max_lease_ttl": "720h"}'  \
 --cap-add=IPC_LOCK --network vault_network vault
like image 131
hariK Avatar answered Sep 13 '25 07:09

hariK