web_1 | /docker-entrypoint.sh: line 99: exec: bundle: not found app_web_1 exited with code 127

I’m trying to use docker to push my existing rails project to a docker container.

I’m using postgres database.

  • Yesod scaffolded site browserId TlsException
  • Setting specific mac address in docker
  • how can I change docker storage driver to devicemapper on mac
  • How can I forward traffic from a specific port to another in open-vswitch
  • How do you run an Openshift Docker container as something besides root?
  • docker license &vm replacement
  • When I did $> docker-compose up

    I get following error in the logs.

    web_1  | /docker-entrypoint.sh: line 99: exec: bundle: not found
    app_web_1 exited with code 127
    

    # Dockerfile
    FROM ruby:2.2.0
    RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
    RUN mkdir /myapp
    WORKDIR /myapp
    ADD Gemfile /myapp/Gemfile
    ADD Gemfile.lock /myapp/Gemfile.lock
    RUN gem install bundler
    RUN bundle install
    ADD . /myapp
    
    FROM postgres:9.4
    #FROM library/postgres
    ENV POSTGRES_USER my-user-name
    ENV POSTGRES_PASSWORD ''
    ENV POSTGRES_DB app-database-name
    

    # docker-compose.yml
    version: '2'
    services:
      db:
        image: postgres
      web:
        build: .
        command: bundle exec rails s -p 3000 -b '0.0.0.0'
        volumes:
          - .:/myapp
        ports:
          - "3000:3000"
        depends_on:
          - db
    

  • how to configure docker to limit the range of ports for spinning up containers
  • docker-compose does not see volumes changes in docker-compose.yml
  • JHipster microservice's sevice restemplate unable to retrieve JWT token_key from UAA server
  • How to create my nginx.conf
  • How to run appium test using aluedeke/appium-android docker image?
  • Error while running Wildfly 10.1.0 - Failed to parse configuration and Current event not START_ELEMENT
  • One Solution collect form web for “web_1 | /docker-entrypoint.sh: line 99: exec: bundle: not found app_web_1 exited with code 127”

    You don’t need two instruction in your Dockerfile, just use docker-compose for overwrite postgres enviroments images.

    You can try this:

    # Dockerfile
    FROM ruby:2.2.3
    
    # Update ubuntu and deps
    RUN apt-get update -qq && apt-get install -y build-essential
    
    # Install postgres dep
    RUN apt-get install -y libpq-dev
    
    # Install nokogiri dep
    RUN apt-get install -y libxml2-dev libxslt1-dev
    
    # Install JS runtime
    RUN apt-get install -y nodejs
    
    ENV APP_HOME /app
    RUN mkdir $APP_HOME
    WORKDIR $APP_HOME
    
    ADD Gemfile* $APP_HOME/
    # Install api deps
    RUN bundle install --jobs 4
    
    ADD . $APP_HOME
    

    Now in your docker-compose.yml (I use v1 version) you can try that:

    postgres:
      image: postgres
    environment:
      POSTGRES_USER: my-user-name
      POSTGRES_PASSWORD: ''
      POSTGRES_DB: app-database-name
    
    web:
      build: .
      command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -b '0.0.0.0'"
      environment:
        PORT: 3000
        DATABASE_URL: 'postgres://postgres:@postgres:5432/postgres'
      ports:
        - '3000:3000'
      link:
        - db
      volumes:
        - .:/app
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.