I've created a docker image of a project (very large project that takes time to compile) and I forgot to add a file in it.
I does not have to do with the build, it's just a test file.
Is it possible to add this file into my image without rebuilding everything ?
Thanks
Here's a full example to pull an image, add a local file to it, retag the image and push it back:
export IMAGE_URL=example.com/your_image:your_tag
docker pull $IMAGE_URL
docker create --name temp_container $IMAGE_URL
docker cp /host/path/to/file temp_container:/container/path/to/file
docker commit temp_container $IMAGE_URL
docker push $IMAGE_URL
Yes its possible, do the steps:
Do the command:
docker cp textFile.txt docker_container_name:/textFile.txt
Commit the container to build a new image with new tag version or another name;
You should try to use docker commit.
Example: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
There's docker cp too, but it only works in running containers.
I hope this helps!
Brhaka