【问题标题】:How can I set an alias in the .bashrc of my Docker image如何在 Docker 映像的 .bashrc 中设置别名
【发布时间】:2018-01-12 17:01:21
【问题描述】:

例如: '别名 python=/home/user/python3.6' 是我可能想要放入我的 bashrc 的东西吗 如何在 Dockerfile 中设置它 我知道设置路径变量的 ENV 命令,是否可以为设置别名做类似的事情?

【问题讨论】:

  • 只需将该行放入您的 .bashrc 文件并将其添加到您的 Dockerfile 中

标签: docker dockerfile


【解决方案1】:

只需使用 RUN 将别名添加到 bash_profile

FROM ubuntu
MAINTAINER Mojtaba Yeganeh

RUN echo "alias python=/home/user/python3.6" >> ~/.bash_profile

【讨论】:

【解决方案2】:

对我来说,它在 .bashrc 文件中工作。

我已将其放入 Dockerfile

RUN echo "alias ll='ls -alF'" >> ~/.bashrc

【讨论】:

    猜你喜欢
    • 2015-03-28
    • 1970-01-01
    • 1970-01-01
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-20
    • 2021-04-30
    相关资源
    最近更新 更多