Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails entrypoint.sh exec:@:未找到_Ruby On Rails_Docker_Docker Compose_Docker Entrypoint - Fatal编程技术网

Ruby on rails entrypoint.sh exec:@:未找到

Ruby on rails entrypoint.sh exec:@:未找到,ruby-on-rails,docker,docker-compose,docker-entrypoint,Ruby On Rails,Docker,Docker Compose,Docker Entrypoint,我遵循本教程: 我想用PostgreSQL数据库(Dockerized)创建一个RubyonRails API 但是当我跑的时候 docker compose运行web rails新建--force--no deps--api--database=postgresql 我明白了: 正在创建软vape数据库。。。完成 /usr/bin/entrypoint.sh:第8行:exec:@:未找到 entrypoint.sh #!/usr/bin/env bash set -e rm -f /myap

我遵循本教程:

我想用PostgreSQL数据库(Dockerized)创建一个RubyonRails API

但是当我跑的时候

docker compose运行web rails新建--force--no deps--api--database=postgresql

我明白了:

正在创建软vape数据库。。。完成
/usr/bin/entrypoint.sh:第8行:exec:@:未找到

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

有什么想法吗?

这个问题已经很老了,但我在使用文档中的示例时也遇到了这个问题,所以我希望这对其他人有所帮助。解决方案非常简单。 rails new命令前面应该加上
bundle exec


所以运行
docker compose运行web bundle exec rails new--force--no-deps--api--database=postgresql

我会在本地运行
railsnew
,并在引入Docker之前尝试让应用程序工作。在Docker中打包它是最后一步,而不是第一步。试着去掉引号。使用
exec$@
。嗯?当您的文件有4行时,您的错误怎么会显示为“error…line 8”?您确定错误仍然与此处显示的代码相关吗?我刚刚删除了文件的注释;)但这是针对这一行的。我仍然有错误@kichik,没有引号:s/usr/bin/entrypoint.sh:line 8:exec:@:notfound