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

18,136

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
Share:
18,136

Related videos on Youtube

Sergei Kobets
Author by

Sergei Kobets

Updated on September 15, 2022

Comments

  • Sergei Kobets
    Sergei Kobets over 1 year

    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 ?

    • dnephin
      dnephin over 7 years
      To debug it, try adding set -x; to the beginning of that line. It should print out more details about what it's doing. The error messages one of the things failed.