图解错误exec:“bundle”:在$ PATH中找不到可执行文件

时间:2014-12-21 07:29:53

标签: sinatra docker fig

我正在尝试使用fig运行没有数据库的Dockerized sinatra应用程序,但我一直收到此错误:

$ fig up
Recreating my_web_1...
Cannot start container 93f4a091bd6387bd28d8afb8636d2b14623a08d259fba383e8771fee811061a3:   exec: "bundle": executable file not found in $PATH

这是Dockerfile

FROM ubuntu-nginx

MAINTAINER Ben Bithacker ben@bithacker.org

COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock

WORKDIR /app

RUN ["/bin/bash", "-l", "-c", "bundle install"]

ADD config/container/start-server.sh /usr/bin/start-server
RUN chmod +x /usr/bin/start-server

ADD . /app

EXPOSE 9292

 CMD ["/usr/bin/start-server"]

config / container / start-server.sh看起来像这样

#!/bin/bash
cd /app
source /etc/profile.d/rvm.sh
bundle exec rackup config.ru

fig.yml看起来像这样:

web:
 build: .
 command: bundle exec rackup config.ru
 volumes:
   - .:/app
 ports: 
    - "3000:3000"
  environment:
   - SOME_VAR=adsfasdfgasdfdfd
   - SOME_VAR2=ba2gezcjsdhwzhlz24zurg5ira

1 个答案:

答案 0 :(得分:1)

我认为此设置存在一些问题。捆绑安装在哪里?通常你会apt-get install ruby-bundler,而且它总会在你的道路上。

我相信您的直接问题是,您正在使用CMD中的Dockerfile覆盖command的{​​{1}}。我假设(根据fig.yml的内容)你需要设置路径?您应该从start-server.sh删除command行。

您还使用fig.yml中的/app覆盖容器中的volumes: .:/app目录。您可能还想删除该行。