在执行 docker build
时报错 source: not found
,有点错愕,Google 后才知道 build
时默认使用的是 /bin/sh
环境,/bin/bash
才可以使用 source
。
下面我们有两种方式可以生效
执行该命令时指定 /bin/bash
环境
1 | RUN /bin/bash -c "source ~/.bashrc" |
指定全局 shell 环境
1 | SHELL ["/bin/bash", "-c"] |
最近热读
扫码关注公众号,或搜索公众号“温欣爸比”
及时获取我的最新文章
