[英]Docker-compose rails image won't start after reboot
It ran just before I rebooted my machine, and suddenly I get Could not locate Gemfile or .bundle/ directory
when starting the container. 它在我重新启动计算机之前
Could not locate Gemfile or .bundle/ directory
运行,并且突然启动容器时,我Could not locate Gemfile or .bundle/ directory
。
During build, which completes without issue, I can see the contents of /app are correct, but on startup, /app only contains a .bundle directory and nothing else. 在构建过程中,该过程没有问题,可以看到/ app的内容正确,但是在启动时,/ app仅包含.bundle目录,除此之外没有其他内容。
UPDATE : Turns out the volume ./documents_api:/app
is what isn't working. 更新 :结果卷
./documents_api:/app
无法正常工作。 Environment is docker for windows 17.09.1 running as administrator 环境是以管理员身份运行的Windows 17.09.1的Docker
Here is my folder structure: 这是我的文件夹结构:
./
.env
docker-compose.yml
documents_api/
<typical rails directory contents>
Dockerfile
.env just contains RAILS_ENV=development
.env仅包含
RAILS_ENV=development
the dockerfile contains: dockerfile包含:
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app
docker-compose.yml contains: docker-compose.yml包含:
version: '3'
services:
database:
image: mongo
volumes:
- mongo:/var/lib/mongo
env_file:
- .env
ports:
- "27017:27017"
documents:
build: ./documents_api
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ./documents_api:/app
env_file:
- .env
expose:
- "3000"
depends_on:
- database
frontend:
image: nginx
build: ./web
depends_on:
- documents
ports:
- "80:80"
- "144:144"
# Persistence
volumes:
mongo:
Turns out I needed to remap my shared drives in the settings. 原来,我需要在设置中重新映射共享驱动器。 It had lost the credentials after the reboot and was silently failing to map the volume.
重新启动后它丢失了凭据,并且静默地无法映射该卷。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.