For example: 'alias python=/home/user/python3.6' Is something I might want to put into my bashrc How do I set this in a Dockerfile I know of the ENV command which sets path variable, is it possible to do similar for setting an alias?
Asked
Active
Viewed 9,926 times
3
-
1just put that line into your .bashrc file and ADD it to your Dockerfile – Scott Stensland Jan 12 '18 at 20:53
2 Answers
11
simply use RUN to add an alias to bash_profile
.
FROM ubuntu
MAINTAINER Mojtaba Yeganeh
RUN echo "alias python=/home/user/python3.6" >> ~/.bash_profile

Bartleby
- 1,144
- 1
- 13
- 14

Mojtaba Yeganeh
- 2,788
- 1
- 30
- 49
-
shouldn't this be simply `RUN echo "alias python=..." >> ~/.bash_profile`? https://stackoverflow.com/a/36388856/5339857 – Roy Shilkrot Jan 06 '20 at 21:00
-
1
For me it worked in .bashrc file.
I've put this in Dockerfile:
RUN echo "alias ll='ls -alF'" >> ~/.bashrc

Iasmini Gomes
- 727
- 1
- 9
- 14