How to copy / ADD file to current WORKDIR in Dockerfile

COPY / ADD operation requires 2 parameters. How to add a file to the current worklist that was installed in the base image?

FROM company/app COPY local.conf 

Of course, I can add the WORKDIR clause before COPY to explicitly declare it. But that would be problematic if the workdir in company/app changed.

+7
docker dockerfile
source share
2 answers

It turns out to be very simple. I just need to use the dot to copy to the current working folder.

 COPY local.conf . 

I still can’t understand if he has any errors. But he works as intended.

+7
source share

But it will be problematic if the working group in the company / application changes.

Then you will need to pass this workdir as an assembly time parameter in order to be able to change it from one docker assembly to another.
See Docker build --build-arg

You need to first docker inspect company/app (check the image) to see if there are any changes.

+1
source share

All Articles