Docker本地文件下载

时间:2017-12-27 11:43:38

标签: docker curl

我正在尝试将我的SDK停靠为

docker run --rm -it -v /home/ubuntu/work/yoctosdk/:/workdir crops/extsdk-container --url file:///home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh

不幸的是我得到了

Attempting to download file:///home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh
curl: (37) Couldn't open file /home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh
Unable to download "file:///home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh".

我正在尝试解决此问题,以便在docker中下载并运行本地文件。什么是正确下载本地文件?我正在关注this

1 个答案:

答案 0 :(得分:1)

默认情况下,无法从主机访问文件。您需要装入要访问Docker容器的文件夹。

要使文件/home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh可访问,请使用以下命令安装其父目录:

-v /home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk:/home/ubuntu/work/yocto/sdk-installer

然后在docker容器

中提供 路径作为url
--url file:///home/ubuntu/work/yocto/sdk-installer/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh

完整命令:

docker run --rm -it -v /home/ubuntu/work/yoctosdk/:/workdir crops/extsdk-container -v /home/ubuntu/work/yocto/poky/build/tmp/deploy/sdk:/home/ubuntu/work/yocto/sdk-installer --url file:///home/ubuntu/work/yocto/sdk-installer/poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh