I have a Debian docker. In one line I define an alias in Dockerfile
:
RUN echo alias Kill="ps -ef | grep 'dotnet' | grep -v grep | awk '{print $2}' | xargs -r kill -9" >> /etc/bash.bashrc
And when I build this docker image and run it, I can verify the line is appended to the /etc/bash.bashrc
file.
However, when I type Kill
I get:
bash: Kill: command not found
What do I do wrong here?
bash
or is it maybesh
? Does it work as expected if you add it to/etc/profile
instead?alias Kill=ps -ef | grep ....
to the file, and that will fail since the lack of quoting means-ef
will be seen as options toalias
, which doesn't understand thembash
. I have not tested the/etc/profile
. But doesn't it load/etc/bash.bashrc
?