Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/68.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 Docker:错误:服务';app&x27;未能生成:复制失败:stat/var/lib/docker/tmp/docker-builder818844007/entrypoint.sh:没有这样的文件或目录_Ruby On Rails_Mongodb_Docker_Docker Compose - Fatal编程技术网

Ruby on rails Docker:错误:服务';app&x27;未能生成:复制失败:stat/var/lib/docker/tmp/docker-builder818844007/entrypoint.sh:没有这样的文件或目录

Ruby on rails Docker:错误:服务';app&x27;未能生成:复制失败:stat/var/lib/docker/tmp/docker-builder818844007/entrypoint.sh:没有这样的文件或目录,ruby-on-rails,mongodb,docker,docker-compose,Ruby On Rails,Mongodb,Docker,Docker Compose,当我用MongoDB构建容器时遇到问题,当使用docker compose up时,我得到以下错误 错误:服务“app”生成失败:复制失败:stat/var/lib/docker/tmp/docker-builder367230859/entrypoint.sh:没有这样的文件或目录 我试图将mongo更改为PostgreSQL,但仍在继续。 我的档案在下面,提前谢谢 那个码头工人 version: '3' services: web: image: nginx resta

当我用MongoDB构建容器时遇到问题,当使用docker compose up时,我得到以下错误 错误:服务“app”生成失败:复制失败:stat/var/lib/docker/tmp/docker-builder367230859/entrypoint.sh:没有这样的文件或目录

我试图将mongo更改为PostgreSQL,但仍在继续。 我的档案在下面,提前谢谢

那个码头工人

version: '3'

services:
  web:
    image: nginx
    restart: always
#    volumes:
#      - ${APPLICATION}:/var/www/html
#      - ${NGINX_HOST_LOG_PATH}:/var/log/nginx
#      - ${NGINX_SITES_PATH}:/etc/nginx/conf.d
    ports:
      - "80:80"
      - "443:443"
    networks:
      - web
  mongo:
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: admin
      MONGO_INITDB_ROOT_PASSWORD: password
    ports:
       - "27017:27017"
    # volumes:
    #   - data:/data/db
    networks:
      - mongo
  app:
    build: .
    volumes:
      - .:/mm_api
    ports:
      - 3000:3000
    depends_on:
      - mongo
networks:
  web:
    driver: bridge
  mongo:
    driver: bridge´´
那个码头工人

FROM ruby:2.7.0
RUN apt-get update -qq && apt-get install -y nodejs
RUN mkdir /mm_api
WORKDIR /mm_api
COPY Gemfile /mm_api/Gemfile
COPY Gemfile.lock /mm_api/Gemfile.lock
RUN bundle install
COPY . /mm_api

COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh

ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000

CMD ["bundle", "exec", "puma", "-C", "config/puma,rb"]
#CMD ["rails", "server", "-b", "0.0.0.0"]
这个切入点

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

在使用Docker开发Rails 6应用程序时,我遇到了类似的问题

当我运行
docker compose build
时,我得到一个错误:

Step 10/16 : COPY Gemfile Gemfile.lock ./
ERROR: Service 'app' failed to build : COPY failed: stat /var/lib/docker/tmp/docker-builder408411426/Gemfile.lock: no such file or directory
以下是我如何修复它的方法

问题是我的项目目录中缺少
Gemfile.lock
。当我的gem依赖项出现问题时,我已经删除了

我所要做的就是运行下面的命令来安装必要的gems,然后重新创建
Gemfile.lock

捆绑安装

然后这次当我运行命令
docker compose build
时,一切又恢复了正常

因此每当您遇到此问题时,请尽力检查文件是否存在于您的目录中,最重要的是,您为文件指定的路径是否正确

就这些


我希望这有帮助

该错误意味着
entrypoint.sh
文件与
Dockerfile
不在同一目录中。您应该能够在运行
docker build.
时重现相同的错误,而不需要
docker compose.yml
文件。