How to transfer files between Docker container and local machine

How to transfer files between Docker container and local machine

To transfer files between the host and the container, the full ID of the container is required.

The acquisition method is as follows:

1. First get the short ID or specified name of the container.

2. Then get the full ID name based on any of these two items.

With this long ID, file transfer between the local machine and the container is simple.

docker cp local file path ID full name: container path 

After entering the container, you can see the files just uploaded.

If the container transfers files to the local machine, the reverse is fine:

docker cp ID full name: container file path local path

For mounting, you can refer to this article: Using Volume to transfer files between the host and Docker container.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to use Docker container to access host network
  • How to communicate between WIN10 system and Docker internal container IP
  • Steps to set up and mount shared folders on Windows host and Docker container

<<:  How to use resident nodes for layer management in CocosCreator

>>:  Linux implements automatic and scheduled backup of MySQL database every day

Recommend

Vue+element ui realizes anchor positioning

This article example shares the specific code of ...

MySQL database JDBC programming (Java connects to MySQL)

Table of contents 1. Basic conditions for databas...

Problems with installing mysql and mysql.sock under linux

Recently, I encountered many problems when instal...

Several ways to solve the 1px border problem on mobile devices (5 methods)

This article introduces 5 ways to solve the 1px b...

Understanding the CSS transform-origin property

Preface I recently made a fireworks animation, wh...

Example of horizontal arrangement of li tags in HTMl

Most navigation bars are arranged horizontally as...

Why are the pictures on mobile web apps not clear and very blurry?

Why? The simplest way to put it is that pixels are...

How to implement on-demand import and global import in element-plus

Table of contents Import on demand: Global Import...

Some useful meta setting methods (must read)

<meta name="viewport" content="...

3 ways to create JavaScript objects

Table of contents 1. Object literals 2. The new k...

Solution to secure-file-priv problem when exporting MySQL data

ERROR 1290 (HY000) : The MySQL server is running ...

Mysql optimization Zabbix partition optimization

The biggest bottleneck of using zabbix is ​​the d...

How to monitor the running status of docker container shell script

Scenario The company project is deployed in Docke...