Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize the file copy between Docker host and container

Shulou Source: shulou.com Published: 2022-05-31 20:04:52 10月02日 Update

This article mainly explains "how to realize the file copy between the Docker host and the container". The content in the article is simple and clear, and it is easy to learn and understand. please follow the editor's train of thought to study and learn "how to realize the file copy between the Docker host and the container".

1. Copy files from the host to the container

Docker run-it-v: / bin/bash

You can then use cp to copy files in the container today, such as:

# docker run-it-v ~ / Downloads:/Downloads bigsnow/centos-ssh-java / bin/bash # Mount the host's Downloads directory to the container's / Downloads# [root@c204a1b7781e /] # cp hadoop-3.0.0-alpha4.tar.gz / home/hadoop

2. Copy the file from the container to the host:

# docker cp: / home/hadoop/hadoop-3.0.0-alpha4.tar.gz / home/hadoop Thank you for your reading. The above is the content of "how to copy files between Docker hosts and containers". After the study of this article, I believe you have a deeper understanding of how to achieve file copies between Docker hosts and containers, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Containers hosts copies files between learning content that is ideas situations articles more directories knowledge knowledge points articles follow questions practice push Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker vpn Huawei NVidia