Learning 13-docker docker container file import and export

Foreword

Docker built environment, often need to interact with the interior of the container docker file, the external file (or host) transmission to the interior of the container.
Or to lead out of the interior of the container file

rz and sz

Docker advanced internal container, is following in the container operation

  • rz import file on the computer to the interior of the container
  • sz inside the container to export the file to a local computer

Use rz and sz commands need to install lrzsz kits, systems CentOS yum

yum install lrzsz

ubuntu systems apt-get

apt-get install lrzsz

Rz using the local computer files to docker container, enter rz will bring up the file selection box, select the file to upload

The interior of the container exported file to the local computer with the sz command with the file name

sz filename

docker cp Copy command

If you do not enter the container, operating on the host can be achieved and the inner container docker host command file interaction, the following operations are host

Copy the files on the host into the interior of the container docker

docker cp / path / filename container id or name: / path / filename

Also can copy files to the internal local docker container

docker cp container id or name: / path / filename / path / filename

Guess you like

Origin www.cnblogs.com/yoyoketang/p/12131002.html