Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dockerfile build /bin/sh -c returned a non-zero code: 1

my dockerfile conf:

    FROM ubuntu:16.04
    MAINTAINER S.K.
    RUN apt-get update
    RUN apt-get install curl -y
    RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
    RUN export NVM_DIR="$HOME/.nvm"
    RUN [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
    RUN nvm install node
    RUN nvm use 6.9.1
    RUN npm i express -g
    RUN npm i nunjucks -g
    RUN npm i nodemon -g
    RUN mkdir -p PROJECT
    VOLUME /PROJECT/
    EXPOSE 1520

In the step RUN [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" Im get error:

The command '/bin/sh -c [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' returned a non-zero code: 1 

Everybody knows how I can fix it ?

like image 816
Sergei Kobets Avatar asked Oct 30 '22 17:10

Sergei Kobets


1 Answers

I solved my problem ! Thanks for all, who tried to help me ! After each command (RUN, CMD and else) Docker makes container, save changes on docker image and delete container before next command.Docker also compress directories and files each command iteration. You should know it before do anything, if you don't want to get an exception or error..

This is working code :

FROM ubuntu:16.04
MAINTAINER S.K.
RUN apt-get update
RUN apt-get install curl -y
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" \
&& nvm install 6.9.1 \
&& npm i express -g \
&& npm i nunjucks -g \
&& npm i nodemon -g \
&& npm i gulp -g \
RUN mkdir -p ./PROJECT
EXPOSE 1520
like image 188
Sergei Kobets Avatar answered Nov 11 '22 03:11

Sergei Kobets