Add a file in a docker image
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:
- Mount the image and make a container
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;