I have a Dockerfile where I am installing nvm. After installation, i'll be needing to install node 5.11 using nvm. The problem is, after installing nvm, the terminal needs to be closed & run again in-order to to have nvm command available.
My docker file looks like:
# Installing Node
RUN Y | curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
# RUN bash --login
RUN exec bash
RUN nvm install 5.11.0
# Installing Project dependencies
RUN npm install yarn -g
RUN npm install -g [email protected]
And the output I am getting is :
Step 5/9 : RUN exec bash
---> Using cache
---> cfcdc4c98714
Step 6/9 : RUN nvm install 5.11.0
---> Running in 1874de4a7715
/bin/sh: 1: nvm: not found
The command '/bin/sh -c nvm install 5.11.0' returned a non-zero code: 127
In real linux after running https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
after closing & starting the terminal the nvm command gets available. How do I do it in dockerfile? Thanks in advance.
Has commands can do this.PATH="$PATH"
and exec bash
So, you can add these command inside your dockerfile.
If exec bash
not work.Try another one.
It's work for me !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With