Updating PATH environment variable permanently in

2019-02-01 09:22发布

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.

3条回答
The star\"
2楼-- · 2019-02-01 09:24

If you want to include a /new/path in the Dockerfile, adding the line:

ENV PATH "$PATH:/new/path"

in Dockerfile should work.

查看更多
男人必须洒脱
3楼-- · 2019-02-01 09:25

Put in your Dockerfile a line ENV PATH xxx see an example in this Dockerfile https://gist.github.com/deepak/5933685

查看更多
来,给爷笑一个
4楼-- · 2019-02-01 09:50

I got the answer for this question in irc chat. Given here for the benefit of anyone who may come across this. Many people have given wrong answers as update the ~/.profile but that did not work. So use the answer below.

Update the file ~/.bashrc for user or update the file /etc/enviroment global for global change which will apply for all users.

In .bashrc export PATH: export PATH=$PATH:/new/path/bin

In enviroment: PATH=$PATH:/new/path/bin

查看更多
登录 后发表回答