Docker copy files from the container to the host

// to elasticsearch container, for example
 // run es
docker run -d -p 9200:9200  elasticsearch:5.4
// Check the container has been running
docker ps
// go inside the container, locate the files and directories to be copied
Exec Docker -it 2c2600fb60f8 / bin / bash
 // exit from the container
exit
// the copy to the host as specified directory container id elasticsearch.yml files in the container 4db8edd86202:
docker cp 4db8edd86202:/usr/share/elasticsearch/config/elasticsearch.yml /home/haopeng/es

 

Guess you like

Origin www.cnblogs.com/xulei1992/p/12034736.html