0

I have below structure

folder1
    Dockerfile
    start.sh
folder2
    config.ini
someotherfiles

inside the Dockerfile

i have added

COPY ../folder2/config.ini /
COPY ../somotherfiles /

Now when I build the docker, i'm getting error file not found.

how can I copy the files which is one folder up where the Dockerfile exists?

change198
  • 1,647
  • 3
  • 21
  • 60
  • From where are you performing `docker build` ? `COPY` arguments are relative to where execute this command, not to the `Dockerfile` – Blusky May 29 '20 at 07:42
  • ahh! thanks may be you are right. I was executing docker build in parent location. not in folder1. I will change accordingly and let you know. – change198 May 29 '20 at 07:45
  • Ok, let met write an answer then :-) – Blusky May 29 '20 at 07:47

1 Answers1

0

file not found might be because you are not executing docker build from the same directory as your Dockerfile is.

COPY arguments are interpreted relatively from where you execute docker run, not from where the Dockerfile is.

Blusky
  • 3,470
  • 1
  • 19
  • 35