Docker Community Forums

Share and learn in the Docker community.

Copy files from Windows host to Ubuntu container


(Plaguedocktor) #1

Hello, all

Is it posible to use COPY command to copy files from windows host to ubuntu container. I’ve tried many formats of path:

COPY E:/mypath /path/on/ubuntu
COPY E/mypath /path/on/ubuntu
COPY //E/mypath /path/on/ubuntu
COPY E://mypath /path/on/ubuntu
COPY E:\mypath /path/on/ubuntu

NO one works : lstat /e/books: no such file or directory


(Michael Friis) #2

The path you copy from has to be relative from the build context (the . in docker build .). It cannot be an arbitrary path on the system outside of the build context.


(Vaseem MV) #3

for example, if you are copying from your Windows directory @ C:\test into your Linux container with name <trucky_ganta> the command would be

C:\windows\system32>docker cp C:\test trucky_ganta:/test

test is copied to your Linux home