如何在Docker镜像的.bashrc中设置别名

时间:2018-01-12 17:01:22

标签: docker dockerfile

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

2 个答案:

答案 0 :(得分:2)

只需使用RUN为bash_profile添加别名。

FROM ubuntu
MAINTAINER Mojtaba Yeganeh

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

答案 1 :(得分:0)

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

我已经把它放在 Dockerfile 中:

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