Nick
Nick

Reputation: 109

run script in Dockerfile

I have to run my .sh script in Dockerfile based on "grafana/grafana" but I'm not sure how to do it.

FROM grafana/grafana
COPY setup.sh /setup.sh
CMD ["/bin/bash", "/setup.sh"]

after docker run my script is not running. I guess it due to in grafana Dockerfile runs another sh script.

Upvotes: 0

Views: 7553

Answers (2)

Facundo Diaz Cobos
Facundo Diaz Cobos

Reputation: 367

There are two ways to do it inside Dockerfile

RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)

RUN ["executable", "param1", "param2"] (exec form)

Upvotes: 1

Deepak Jain
Deepak Jain

Reputation: 347

Can you please try if that works:

RUN ./setup.sh

Upvotes: 5

Related Questions