entrypoint.sh exec:@:找不到

时间:2019-03-13 19:50:11

标签: ruby-on-rails docker docker-compose docker-entrypoint

我正在关注本教程:

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

entrypoint.sh

#!/usr/bin/env bash
set -e
rm -f /myapp/tmp/pids/server.pid
exec "$@"

Dockerfile

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

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

这个问题已经很老了,但是当我使用文档中的示例时,我也遇到了这个问题,因此希望对您有所帮助。解决方案非常简单。 rails new命令应以store = {} L = [['DDX11L1', 'lincRNA', 'chr1', 11869, 14409], ['WASH7P', 'lincRNA', 'chr1', 14404, 29570], ['MIR1302-2HG', 'lincRNA', 'chr1', 29554, 31109], ['FAM138A', 'lincRNA', 'chr1', 34554, 36081], ['OR4G4P', 'unprocessed_pseudogene', 'chr2', 52473, 53312], ['DDX11L1', 'transcribed_unprocessed_pseudogene', 'chr2', 11869, 14409], ['WASH7P', 'lincRNA', 'chr2', 14404, 29570], ['MIR1302-2HG', 'lincRNA', 'chr1', 29554, 31109], ['FAM138A', 'lincRNA', 'chr3', 34554, 36081], ['OR4G4P', 'unprocessed_pseudogene', 'chr2', 52473, 53312]] if L: for rec in L: if rec[1] == "lincRNA": if rec[2] in store: store[rec[2]] = store[rec[2]] + 1 else: store[rec[2]] = 1 for key, value in store.items(): print("There are '{0}' linkRNA with '{1}'".format(value, key)) 开头。

因此,运行bundle exec