Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy a file with different name in destination directory using COPY in Dockerfile

Can I copy a file with different Name in Docker image using COPY in Dockerfile. I am trying with below:

COPY file /dest/<renamed_file>
like image 394
Navneet Nandan Jha Avatar asked Oct 08 '18 08:10

Navneet Nandan Jha


1 Answers

You can simply do it like COPY test.txt /dest/test_renamed.txt without a trailing /.

If you put a trailing / like COPY test.txt /dest/test_2/, it will copy the test.txt file (with the same name, of course) into the directory at /dest/test_2/.

like image 64
gravetii Avatar answered Nov 02 '22 08:11

gravetii