LoginSignup
6
6

More than 3 years have passed since last update.

ホストの環境変数を Docker Compose を使ってコンテナ内に引き継ぐ方法

Last updated at Posted at 2018-11-12

引き継ぎたい環境変数名を書くだけでホストの環境変数をコンテナ内に引き継ぐことができます。
以下は、docker-composeの例です。

version: '3'
services:
    mysql:
        build: mysql
        ports:
            - "3306:3306"
            restart: always
        environment:
            - PATH        # export PATH=aiueo などをホストでしたもの

参考

https://docs.docker.com/compose/environment-variables/#pass-environment-variables-to-containers
https://www.kimullaa.com/entry/2018/03/17/130014

6
6
1

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
6
6