Answer the question
In order to leave comments, you need to log in
How to COPY a file to a Dockerfile from neighboring folders?
Good afternoon,
There is a structure:
- app
- docker/containers/parser/Dockerfile
- docker-compose.yml
docker-compose.yml
version: '3.7'
services:
parser:
build: ./docker/containers/parser
volumes:
- ./app:/var/www
working_dir: /var/www
restart: always
tty: true
FROM node:11-slim
WORKDIR /var/www
COPY ../../app/package.json .
...
build:
context: ./app
dockerfile: ./docker/containers/parser/Dockerfile
COPY package.json .
# или COPY ./package.json .
Answer the question
In order to leave comments, you need to log in
You need to specify the context for the Dockerfile.
And specify the Dockerfile itself.
An example of how it could be:
docker-compose.yml
version: '2'
services:
nginx:
build:
context: .
dockerfile: ./images/nginx/Dockerfile
FROM nginx:latest
COPY ["domains/docker.test", "/var/www/docker-bar.test"]
build:
context: ./docker/containers/parser/
dockerfile: Dockerfile
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question