getting error /bin/sh: 1: source: not found
Solution 1
I solved this answer
instead of installing nvm by "source ~/.profile"
i change it to
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=4.5.0
RUN . $HOME/.nvm/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default
Solution 2
From Docker docs:
The default shell for the shell form can be changed using the SHELL command.
In the shell form you can use a \ (backslash) to continue a single RUN instruction onto the next line. For example, consider these two lines: RUN /bin/bash -c 'source $HOME/.bashrc ;\ echo $HOME' Together they are equivalent to this single line: RUN /bin/bash -c 'source $HOME/.bashrc ; echo $HOME'
Note: To use a different shell, other than ‘/bin/sh’, use the exec form passing in the desired shell. For example, RUN ["/bin/bash", "-c", "echo hello"]
You could try:
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash
# RUN source ~/.profile
RUN ["/bin/bash", "-c", "source ~/.profile"]
Musaddique S
Updated on November 17, 2020Comments
-
Musaddique S over 3 years
I am trying to build docker and installing nvm
some code line
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.25.0/install.sh | bash RUN source ~/.profile
curl run successfully but when running source, getting below error
/bin/sh: 1: source: not found The command '/bin/sh -c source ~/.profile' returned a non-zero code: 127
-
Musaddique S over 7 yearshere i am getting same issue.
-
Tuan over 7 yearsWhat happed at line
RUN ["/bin/bash", "-c", "source ~/.profile"]
? -
Musaddique S over 7 yearsThe command '/bin/bash -c source ~/.profile' returned a non-zero code: 1
-
Musaddique S over 7 yearsnow again i am getting other error for --- RUN npm install---- also tried ---RUN ["/bin/bash", "-c", "npm install"]---
-
Tuan over 7 yearsLook like you're trying to build a node.js application inside a Docker container? You might need to post the full source code or the source code link to review.