31
14

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コンテナに環境変数を渡す

Posted at

やりたいこと

コンテナにAWSのアクセスキーIDと秘密アクセスキーを渡したい

直接runするとき

docker run -e AWS_ACCESS_KEY_ID=xxxx -e AWS_SECRET_ACCESS_KEY=yyyy [tag]

composeファイルに書くとき

environment:
    - AWS_ACCESS_KEY_ID: xxxx
    - AWS_SECRET_ACCESS_KEY: yyyy

とかする

ファイルに埋めたくないとき

environment:
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY

ってやっておくとホストの環境変数が参照されるようなのでこちらがベターでしょう。

31
14
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
31
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?