`cp` vs `rsync` vs something faster `cp` vs `rsync` vs something faster docker docker

`cp` vs `rsync` vs something faster


This is not allowed and it won't be

https://github.com/moby/moby/issues/1676

We do not allow this because it's not repeatable. A symlink on your machine is the not the same as my machine and the same Dockerfile would produce two different results. Also having symlinks to /etc/paasswd would cause issues because it would link the host files and not your local files.

If you have common files which are needed in every container then I would put all of them in a shared image and use docker multi build options

FROM mysharedimage as sharedFROM alpineCOPY --from=shared /my/common/stuff /common....

Again still not the most elegant solution but, because when you do docker build the current context is zipped and sent to the docker daemon, soft links won't work.

You can create hard links but then hard links point to inodes and they don't show you which file they point to. Soft links on other tell you where they point to but the build doesn't sent them.

ln /source/file /dest/file

So your call really what you want to do and how you want to.