简体   繁体   中英

Dockerfile - how to run script?

Created a docker file, but unable to get run the rail setup script ie ./bin/setup to execute

What am I doing wrong? RUN /bin/bash -C "/usr/src/app/bin/setup" this does not work.

I also tried this RUN ./bin/setup (this also does not work!)

Dockerfile

FROM ruby:2.3

RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*

ENV RAILS_VERSION 5

RUN gem install rails --version "$RAILS_VERSION"

WORKDIR /usr/src/app
COPY . .
# setup does not run, why?
RUN /bin/bash -C "/usr/src/app/bin/setup"

...

I was facing a similar dos/unix issue. I did a git check out of a file in windows and added it to docker image(linux). If that is the case sed is your friend. Just add following to your Dockerfile :

RUN /bin/sed s/\\r//g -i /usr/src/app/bin/setup

Might save you from installing an additional package. Hope it help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM