1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Docker HubのVaultをサーバーモードで使う際にハマった時のメモ

Posted at

Running Vault in Server Mode に記載されている以下のコマンドでは、ホストから接続可能なコンテナを起動できませんでした。

docker run --cap-add=IPC_LOCK -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/vault/file"}}, "default_lease_ttl": "168h", "max_lease_ttl": "720h"}' vault server

ポイント(だと考えるところ、認識誤りだったら済みません。ご指摘いただけると助かります。)

  • TLSを無効
  • tcpのアドレスを 0.0.0.0:8200 へ変更

それから、上記コマンドだとコンテナのポートを公開していないので-pオプションでホストに公開する必要があります。
また、上記コマンドだと以下の警告ログが出力されました。

[WARN]  no `api_addr` value specified in config or in VAULT_API_ADDR; falling back to detection if possible, but this value should be manually set

そのため、VAULT_LOCAL_CONFIGの中でapi_addrを指定するか、VAULT_API_ADDRでVault APIのアドレスを指定する必要があります。

上記をふまえて、最終的なコマンド例が以下になります。

ホストからアクセス可能なサーバーモードで起動する場合のコマンド例

docker run --cap-add=IPC_LOCK -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/vault/file"}}, "api_addr": "http://127.0.0.1:8200", "listener": {"tcp": {"address": "0.0.0.0:8200", "tls_disable": "true"}}}}' -p 8200:8200 vault server

以上です。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?