在Docker容器中永久更新PATH环境变量 [英] Updating PATH environment variable permanently in Docker container

查看:3886
本文介绍了在Docker容器中永久更新PATH环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试添加到文件〜/ .profile 中的 PATH etc / profile 如下。

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.

推荐答案

如果您要在...中添加 / new / path Dockerfile ,添加以下行:

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

ENV PATH$ PATH:/ new / path

ENV PATH "$PATH:/new/path"

Dockerfile 中应该可以使用。

这篇关于在Docker容器中永久更新PATH环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆