在 Windows Docker 容器中附加到 PATH [英] Appending to PATH in a Windows Docker container
本文介绍了在 Windows Docker 容器中附加到 PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I need to append to the PATH within a Windows Docker container, and I've tried many permutations.
ENV PATH=%PATH%;C:\Foo\bin
ENV PATH=$PATH;C:\Foo\bin
ENV PATH="%PATH%;C:Fooin"
ENV PATH="$PATH;C:Fooin"
RUN "set PATH=%PATH%;C:Fooin"
None of these work: they don't evaluate the preexisting PATH variable.
What is the right syntax to append to the PATH? Can I even append to the PATH inside Docker? (I can on similar Linux containers)
解决方案
Unfortunately ENV
won't work, because windows environment variable work a little differently than linux. more info
As of now the only way to do this is through RUN
But you don't need to create a separate file to do this. This can be done by the following much simpler one line command:
RUN setx path "%path%;C:Fooin"
这篇关于在 Windows Docker 容器中附加到 PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文