Copy Files Between A Container host And A Windows Container

As part of my Docker coverage series and Yesterday’s post about deleting multiple Container, In this post, I’ll show how you copy files between a Container and a Container Host.

If you haven’t created a Container Host yet, visit the following post  How to Deploy Windows Containers (June 2017)  and the Windows Containers page.

To start, On a running container create a new Directory

In my case, I have created a folder called files on the running container

To copy a file from the Host to the Container type the command below:

Docker cp file.csv container_name:/location_on_ the_c_ drive

The example below will copy a file caleed users.csv to a folder called Files on the container that I have created In the first step.

To copy the files to the C:\ drive leave the path black after the /

Docker cp file.csv container_name:/

As you can see the files Is located on the root of the C drive on the container

To copy files from the container to the Container host use:

Docker cp test01:test.txt /

Docker cp test01:test.txt /


Posted

in

by