Reputation: 2062
I have got an error while executing the following shell on my ubuntu vbox.
docker-compose up -d
Step 1/4 : FROM postgres:9.4
---> d1b08fdd94ed
Step 2/4 : RUN mkdir /docker-entrypoint-initdb.d/census/
---> Using cache
---> 35c38c9966fb
Step 3/4 : COPY ./sql/census/ /docker-entrypoint-initdb.d/census
ERROR: Service 'db' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder974990962/sql/census: no such file or directory
I searched on google but didn't get a tip to fix this problem.
Could you help me with this?
Thanks for your attention. Best regards, Liki
docker-compose.yml
db/Dockerfile
web/Dockerfile
version: "3"
services:
web:
build:
context: .
dockerfile: docker/web/Dockerfile
container_name: wazimap-vpuu
environment:
- DATABASE_URL=postgresql://postgres:postgres@db/postgres
expose:
- "8000"
command: bash -c "python manage.py migrate --noinput && python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/vpuu
ports:
- "8000:8000"
depends_on:
- db
db:
build:
context: .
dockerfile: docker/db/Dockerfile
container_name: wazimap-postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data:
FROM postgres:9.4
RUN mkdir /docker-entrypoint-initdb.d/census/
COPY sql/census/ /docker-entrypoint-initdb.d/census
COPY sql/extensions/ /docker-entrypoint-initdb.d/
FROM ubuntu:18.04
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt install -y gdal-bin libgdal-dev
RUN apt install -y python-pip git
ENV CPLUS_INCLUDE_PATH /usr/include/gdal
ENV C_INCLUDE_PATH /usr/include/gdal
RUN mkdir /vpuu
WORKDIR /vpuu
COPY . /vpuu
RUN pip install -r requirements.txt
Upvotes: 1
Views: 727
Reputation: 4504
According to Dockerfile documentation
The
COPY
instruction copies new files or directories from<src>
and adds them to the filesystem of the container at the path<dest>
.
<src>
is specified in context in the docker-compose dockerfile directive
Error COPY failed: stat /var/lib/docker/tmp/docker-builder974990962/sql/census: no such file or directory
means that file sql/census
not found in building context.
To COPY
something, you should put it in building context before that.
Upvotes: 1