Fractale
Fractale

Reputation: 1654

Oh My Zsh install in docker fail

I don't know why this line return 1 when I run it a docker file:

RUN sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

I have wget install and I don't know why it's return 1 (no error message)

Upvotes: 3

Views: 3524

Answers (3)

Chan Aaron
Chan Aaron

Reputation: 1

when you run the following command to install oh-my-zsh, the command installed oh-my-zsh successfully and exited with code 1. (you can run echo $? to check).

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" echo $? #output 1

But, the docker build shell thought it's an error when commands execute without returning code 0. To solve it, we can append a zero-returned command after the install command:

RUN sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"; exit 0;

Upvotes: 0

Ilario Pierbattista
Ilario Pierbattista

Reputation: 3265

I think it's due to the interactive part of the installation script.

You should generate previously .zshrc.

RUN apt-get install -y zsh
RUN git clone https://github.com/robbyrussell/oh-my-zsh \
    <installation_path>/.oh-my-zsh
COPY conf/.zshrc <installation_path>/.zshrc

Upvotes: 0

Matt
Matt

Reputation: 74879

No idea, but you don't have to use the one step install shorthand which might give you a better idea of where the command is failing.

RUN set -uex; \
    wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh; \
    sh ./install.sh; \
    rm ./install.sh

Upvotes: 2

Related Questions