Most common problem "Copying files from host to Docker container" that usually developers face. So here I am providing you a simple command that would be copy a file from host to docker container.
To copy a file into your docker container you have to follow below 3 points.
To copy a file into your docker container you have to follow below 3 points.
- first, copy the path of localhost where your file stored. ** in my case its stored on /home/anil/Desktop/database/database.sql **
- second you have to set a path into your docker container where you want to store your file. ** in my case I created a folder with name "database" and get the path "/home/ubuntu/database/" **
- Now you are to just replace file path, container folder path and container id in below command.
sudo docker cp /home/(user_name)/(folder_name)/(file_name) (your_container_id):/(folder_path_you_want_the_file_to_be)
Now just copy and paste your command into terminal and you will find your file into your docker specified folder path. Enjoy.
Note: Only a member of this blog may post a comment.