Add alias to Docker during build

Viewed 5586

Since I am trying to compile a program during the build phase of a container, I'm including my aliases during the build of the container inside the .bashrc:

RUN cat /path/to/aliases.sh >> ~/.bashrc

When I start the container, all aliases are available. This is already good, but not the behavior that I want.

I've already google around and found out, that the .bashrc file is only loaded when using an interactive shell, which is not the case during the build phase of the container.

I'm trying to force the load of my aliases using:

RUN shopt -s expand_aliases

or

RUN shopt -s expand_aliases && alias

or

RUN /bin/bash -c "both commands listed above..."

Which surprisingly does not yield to the expected outcome. [/irony off]

Now my question: How can I set aliases for the build phase of the container?

Regards

1 Answers
Related