Wednesday, April 22, 2020

phpMyPassion

How to Copy files from host to Docker container?

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.
  1. first, copy the path of localhost where your file stored. ** in my case its stored on /home/anil/Desktop/database/database.sql **
  1. 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/" **
  1. 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.


About Author -

Hi, I am Anil.

Welcome to my eponymous blog! I am passionate about web programming. Here you will find a huge information on web development, web design, PHP, Python, Digital Marketing and Latest technology.

Subscribe to this Blog via Email :

Note: Only a member of this blog may post a comment.