Dockerfile – how to run script?

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

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

  • How to setup heroku app locally using docker?
  • Docker Hub API v2 token authentication issue
  • How to install specific version of Docker on Centos?
  • Can't discover docker container on user defined network
  • Docker Tomcat users configuration not working
  • Docker composed services can't communicate by service name
  • 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"
    
    ...
    

  • WSL in Windows Container
  • Docker user Permission denied on accessing folder in container
  • Pseudo-tty with Fig/Docker container
  • What's the difference between Docker for Windows and Docker on Windows?
  • fio: blocksize too large for data set
  • How to observe scheduled tasks output with Django celery and Docker
  • One Solution collect form web for “Dockerfile – how to run script?”

    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!

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.