Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

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.
by

1 Answer

espadacoder11
For copying the files from the host to the docker container :

1First, set the path in your localhost to where the file is stored.
2Next set the path in your docker container to where you want to store the file inside your docker container.
3Then 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)

Login / Signup to Answer the Question.