MTRNord MTRNord - 1 month ago 16
Bash Question

Copy files to docker image after build

I do have an already build docker image and wan't to add files to it AFTER the build was done. Is there a way to add files without rebuilding it (or maybe to add it and save it with an new tag)? I did find

docker cp
but if I understand that right it does only work in running containers.

Answer

docker cp but if I understand that right it does only work in running containers

Still, that might work considering you can then commit a container into a new image.
See docker commit.

docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]