在 Docker 容器中永久更新 PATH 环境变量 [英] Updating PATH environment variable permanently in Docker container
本文介绍了在 Docker 容器中永久更新 PATH 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试添加到文件 ~/.profile
和 /etc/profile
中的 PATH
如下.
I tried adding to the PATH
in the files ~/.profile
and /etc/profile
as follow.
PATH = $PATH:/required/path
但是,它不起作用.然后我尝试添加行显示,这也不起作用.
However, it does not work. Then I tried with adding the line show, which did not work either.
export PATH
即使重新启动容器和主机后它也不起作用.
It did not work even after restarting the container and the host both.
推荐答案
如果要在 Dockerfile 中包含 /new/path
,请添加以下行:
If you want to include a /new/path
in the Dockerfile, adding the line:
ENV PATH "$PATH:/new/path"
在 Dockerfile 中应该可以工作.
in Dockerfile should work.
这篇关于在 Docker 容器中永久更新 PATH 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文