To copy files from your current to a Docker container, follow the steps below. One given file can be copied using the cp command to the Docker container. This can be achieved using the command below:
docker cp file.txt dockercontainer:/file.txt [copy files to docker container]
To copy the file FROM the container , use the command:
docker cp dockercontainer:/file.txt file.txt
Note that dockercontainer is a container ID (and not an image ID).
To copy several files within a folder fld to the target folder, run the commands:
docker cp fld/. dockercontainer:/target. [docker cp example]
docker cp dockercontainer:/fld/. target
You may want to check the documentation here.
Answer due to this user.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.