Я учусь в университете, и, похоже, никто больше не получает такую ошибку, если у них есть Ma c. Большинство репетиторов не решили использовать docker. Мне нужно использовать это, чтобы пройти. Ниже приведен мой файл docker -compose.yml
version: '3'
services:
db:
image: postgres
environment:
POSTGRES_USER: 'admin'
POSTGRES_PASSWORD: 'password'
# Exposing DB to port `5432` of host machine
ports:
- "5432:5432"
volumes:
- postgres:/data/postgres
web:
build: .
tty: true
stdin_open: true
ports:
- "3000:3000"
depends_on:
- db
environment:
DATABASE_HOST: "host.docker.internal"
DATABASE_USERNAME: "admin"
DATABASE_PASSWORD: "password"
DATABASE_PORT: 5432
volumes:
- .:/myapp:delegated
- bundle:/usr/local/bundle
- cache:/myapp/tmp/cache
volumes:
postgres:
cache:
bundle:
Ниже приведен мой файл docker
FROM ruby:2.5.7
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 -составить сборку в терминале:
db uses an image, skipping
Building web
Step 1/13 : FROM ruby:2.5.7
---> 1de9aa172c47
Step 2/13 : RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
---> Running in 0aaca7e379fd
E: Failed to fetch http://deb.debian.org/debian/dists/buster/main/binary-amd64/by-hash/SHA256/80ed5d1cc1f31a568b77e4fadfd9e01fa4d65e951243fd2ce29eee14d4b532cc File has unexpected size (13168 != 7906744). Mirror sync in progress? [IP: 151.101.28.204 80]
Hashes of expected file:
- Filesize:7906744 [weak]
- SHA256:80ed5d1cc1f31a568b77e4fadfd9e01fa4d65e951243fd2ce29eee14d4b532cc
- MD5Sum:80b6d9c1b6630b2234161e42f4040ab3 [weak]
Release file created at: Sat, 08 Feb 2020 10:57:10 +0000
E: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/main/binary-amd64/by-hash/SHA256/6af9ea081b6a3da33cfaf76a81978517f65d38e45230089a5612e56f2b6b789d File has unexpected size (13184 != 7380). Mirror sync in progress? [IP: 151.101.28.204 80]
Hashes of expected file:
- Filesize:7380 [weak]
- SHA256:6af9ea081b6a3da33cfaf76a81978517f65d38e45230089a5612e56f2b6b789d
Release file created at: Sun, 03 May 2020 08:18:18 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update -qq && apt-get install -y nodejs postgresql-client' returned a non-zero code: 100