![](/img/trans.png)
[英]web_1 | /docker-entrypoint.sh: line 99: exec: bundle: not found app_web_1 exited with code 127
[英]entrypoint.sh exec: @: not found
我正在關注本教程:
https://docs.docker.com/compose/rails/
我想用 PostgreSQL 數據庫 (Dockerized) 創建一個 Ruby On Rails API
但是當我跑
docker-compose run web rails new . --force --no-deps --api --database=postgresql
我懂了:
Creating soft-vape-db ... done /usr/bin/entrypoint.sh: line 8: exec: @: not found
入口點.sh
#!/usr/bin/env bash
set -e
rm -f /myapp/tmp/pids/server.pid
exec "$@"
文件
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]
docker-compose.yml
version: '3'
services:
db:
container_name: soft-vape-db
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
web:
container_name: soft-vape-api
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/myapp
ports:
- "3000:3000"
depends_on:
- db
任何的想法 ?
這個問題已經很老了,但是在使用文檔中的示例時我也遇到了這個問題,所以我希望這對某人有所幫助。 解決方案非常簡單。 rails new 命令應該以bundle exec
開頭。
所以運行docker-compose run web bundle exec rails new . --force --no-deps --api --database=postgresql
docker-compose run web bundle exec rails new . --force --no-deps --api --database=postgresql
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.