Fred J.
Fred J.

Reputation: 6019

What is | bash -

What exactly does | bash - at the end of the first line of this code do in a Dockerfile?
Why the - at the end?

RUN curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
RUN yum install -y tar nodejs

Upvotes: 4

Views: 110

Answers (1)

barsju
barsju

Reputation: 4446

The | bash means to pipe the output from the curl command, i.e. the downloaded bash script, as input to the bash command. The - makes bash read the script from stdin instead of from a file.

In other words, the command downloads a script and executes it with bash.

Upvotes: 5

Related Questions