# Docker - connect DB and create user credentials manually (not in vault) possible?

**URL:** <https://discuss.hashicorp.com/t/docker-connect-db-and-create-user-credentials-manually-not-in-vault-possible/41613>\
**Category:** Vault\
**Created:** [July 5, 2022, 1:30pm UTC](https://discuss.hashicorp.com/t/docker-connect-db-and-create-user-credentials-manually-not-in-vault-possible/41613 "2022-07-05T13:30:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![D0ck](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@D0ck](https://discuss.hashicorp.com/u/D0ck)\
**Post date:** [July 5, 2022, 1:30pm UTC](https://discuss.hashicorp.com/t/docker-connect-db-and-create-user-credentials-manually-not-in-vault-possible/41613/1 "2022-07-05T13:30:47Z")

</div>

Don’t read if you are not familiar with vault and docker (rootless)! 😉

Months have passed.  
I need to know - because I don’t know if it’s possible or not - how to use Docker (rootless) with hasicorp vault and the command “docker run…” and/or with the command “docker compose”.

I found something like this:

> **[MySQL/MariaDB - Database - Secrets Engines | Vault by HashiCorp](https://www.vaultproject.io/docs/secrets/databases/mysql-maria)**
>
> MySQL is one of the supported plugins for the database secrets engine. This
> plugin generates database credentials dynamically based on configured roles
> for the MySQL database.

My idea with docker (rootless):  
I want to use 1 database (docker container) with multiple online stores (each store also has its own docker container).

OffTopic:  
-It doesn’t matter if I run these onlineshops (docker container) with “docker run” or with “docker compose”, because each will have its own subfolder…  
-Each store will have its own database and database user/password.  
-There will be only 1 database container where to connect to

My question:  
If I use Hashicorp Vault and do it like in the link - a few line above - then only Vault can create my database users - correct?  
How can I make it so that I can manually create my database AND my user (using phpmyadmin for example) and vault only creates and uses my password for those users?

Next question:  
What does the command for my persistent data (docker volumes) look like when I use “docker run” and what if I used a docker compose file?

Somehow I have to connect the vault container to the database.

Translated with [DeepL Translate: The world's most accurate translator](http://www.DeepL.com/Translator) (free version)

---

<div class="post-metadata">

**Author:** ![D0ck](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@D0ck](https://discuss.hashicorp.com/u/D0ck)\
**Post date:** [July 24, 2022, 11:51am UTC](https://discuss.hashicorp.com/t/docker-connect-db-and-create-user-credentials-manually-not-in-vault-possible/41613/2 "2022-07-24T11:51:23Z")

</div>

Really? Nobody knows? 🙄
