Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu環境でデプロイするとHOSTNAMEが期待通りに展開されない #53

Open
tichi73 opened this issue Sep 2, 2024 · 2 comments

Comments

@tichi73
Copy link
Contributor

tichi73 commented Sep 2, 2024

Ubuntu環境でデプロイすると環境変数 HOSTNAME が期待どおりに展開されないのか空白として扱われてしまい、各コンテナのホスト名も適切に設定されない。

fixpoint@takahashi-ke2-ub2404-basic1:~/ke2-docker/ke2/single/basic$ echo $HOSTNAME
takahashi-ke2-ub2404-basic1

fixpoint@takahashi-ke2-ub2404-basic1:~/ke2-docker/ke2/single/basic$ docker compose up -d
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
WARN[0000] The "HOSTNAME" variable is not set. Defaulting to a blank string. 
[+] Running 11/11
 ✔ Network ke2_default        Created                                                 0.1s 
 ✔ Volume "ke2_kompira_log"   Created                                                 0.0s 
 ✔ Volume "ke2_kompira_pg16"  Created                                                 0.0s 
 ✔ Volume "ke2_kompira_var"   Created                                                 0.0s 
 ✔ Container ke2-redis-1      Started                                                 0.5s 
 ✔ Container ke2-postgres-1   Started                                                 0.5s 
 ✔ Container ke2-rabbitmq-1   Started                                                 0.4s 
 ✔ Container ke2-jobmngrd-1   Started                                                 0.8s 
 ✔ Container ke2-kengine-1    Started                                                 0.8s 
 ✔ Container ke2-kompira-1    Started                                                 1.3s 
 ✔ Container ke2-nginx-1      Started                                                 2.0s 

fixpoint@takahashi-ke2-ub2404-basic1:~/ke2-docker/ke2/single/basic$ docker exec -it $(docker ps -q -f name=kompira) hostname
ap-
@tichi73
Copy link
Contributor Author

tichi73 commented Sep 2, 2024

Ubuntu では $HOSTNAME は export されておらず環境変数としてアクセスできないらしい。
export HOSTNAME すれば期待通りに展開される。

$ export HOSTNAME
$ docker compose up -d
     :
$ docker exec -it $(docker ps -q -f name=kompira) hostname
ap-takahashi-ke2-ub2404-basic1

@tichi73
Copy link
Contributor Author

tichi73 commented Sep 17, 2024

TODO: 再起動時に問題ないか確認する($HOSTNAME がクリアされて問題再発するなど)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant