docker host file directly with the container movement command

1, the container copy files to the host

We container nginx entire directory copied to the host / usr / local / nginx directory, using the following command:

docker cp nginx_test: /etc/nginx /usr/local/nginx

Description:

nginx_test container name

 / Etc / nginx container directory for directory

 / Usr / local / nginx host directory

 

2. Copy the file to the host vessel

We copy in the host a.key directory (/usr/local/nginx/a.key) to the container (nginx_test)'s / etc / nginx the directory, using the following command:

docker cp /usr/local/nginx/a.key nginx_test:/etc/nginx

Description:

/usr/local/nginx/a.key host file

nginx_test container name

/ Etc / nginx container directory

 

 

See vessel name:

Host file directory:

Container directory:

 

Guess you like

Origin www.cnblogs.com/ming-blogs/p/11099342.html