LoginSignup
3
2

More than 5 years have passed since last update.

Amazon ECSでHashiCorp Vaultを動かそうとしてハマった件

Posted at

問題
Macのローカルで動作していた HashiCorp Vault のDockerイメージをAmazon ECSに持っていったら、タスクが起動停止を繰り返してしまう症状が発生した。

環境
Docker image / 0.8.3, https://hub.docker.com/_/vault/
ECSインスタンス / amzn-ami-2017.03.g-amazon-ecs-optimized (ami-21815747)

原因と対策
ECSインスタンスにログインして、ログを確認したところ、

原因
$ docker logs <CONTAINER ID>
Error initializing core: Failed to lock memory: cannot allocate memory

This usually means that the mlock syscall is not available.
Vault uses mlock to prevent memory from being swapped to
disk. This requires root privileges as well as a machine
that supports mlock. Please enable mlock on your system or
disable Vault from using it. To disable Vault from using it,
set the `disable_mlock` configuration option in your configuration
file.

とのことだった。

一瞬、え?メモリ不足?と思ったのだが、
このECSインスタンスでは mlock が動作しないらしく、
Vaultのconfigに
disable_mlock = 1
を追記し、imageをECRにpushし直したら元気に動くようになった。

めでたしめでたし。

3
2
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
3
2