Copying files from host to Docker container
I am trying to build a backup and restore solution for the Docker containers. How can I copy files from the host to the container?
Appreciate the help.
For copying the files from the host to the docker add file to container:
- First, set the path in your localhost to where the file is stored.
- Next set the path in your docker container to where you want to store the file inside your docker container.
- Then copy the file which you want to store in your docker container with the help of CP command.
ex: sudo docker cp /home/(name)/(folder_name)/(file_name) (container_id):/(to_the_place_you_want_the_file_to_be)