且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Docker env变量在通过shell登录时未设置

更新时间:2023-12-05 13:55:58

issue 2569


这是预期的。 SSH会作为登录过程的一部分来清除环境。

This is expected. SSH wipes out the environment as part of the login process.

解决方法之一是将环境变量转储到 / etc / environment (例如 env | grep _>> / etc / environment ),然后再启动Supervisor。

进一步的登录进程应该是源文件,而tada!有你的环境。

One way to work around it is to dump the environment variables in /etc/environment (e.g. env | grep _ >> /etc/environment) before starting Supervisor.
Further "login processes" should source this file, and tada! There is your environment.

那个 env | grep _>>> / etc / environment 可以是关联的默认运行脚本的一部分(通过 ENTRYPOINT CMD )到您的图像。

That env | grep _ >> /etc/environment could be part of a default run script associated (through ENTRYPOINT or CMD) to your image.