Dockerfile COPY指令失败? [英] Dockerfile COPY instruction failing?

查看:396
本文介绍了Dockerfile COPY指令失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,我正在尝试将文件从主机永久复制到映像,以便基于该映像启动的每个容器都可以使用这些文件。

All, i'm trying to persistently copy files from my host to an image so those files are available with every container launched based on that image. Running on debian wheezy 64bit as virtualbox guest.

Dockerfile非常简单(安装八度映像):

the Dockerfile is fairly simple (installing octave image):

FROM debian:jessie 
MAINTAINER GG_Python <[redacted]@gmail.com>
RUN apt-get update 
RUN apt-get update
RUN apt-get install -y octave octave-image octave-missing-functions octave-nan octave-statistics

RUN mkdir /octave
RUN mkdir /octave/libs
RUN mkdir /octave/libs/jsonlab
COPY ~/octave/jsonlab/loadjson.m /octave/libs/jsonlab/.

发出构建命令后,我得到以下跟踪: docker build -t octave。

I'm getting the following trace after issuing a build command: docker build -t octave .

Sending build context to Docker daemon 423.9 kB
Sending build context to Docker daemon 
Step 0 : FROM debian:jessie
 ---> 58052b122b60
Step 1 : MAINTAINER GG_Python <[..]@gmail.com>
 ---> Using cache
 ---> 90d2dd2f7ee8
Step 2 : RUN apt-get update
 ---> Using cache
 ---> 4c72c25cd829
Step 3 : RUN apt-get update
 ---> Using cache
 ---> b52f0bcb9f86
Step 4 : RUN apt-get install -y octave octave-image octave-missing-functions octave-nan octave-statistics
 ---> Using cache
 ---> f0637ab96d5e
Step 5 : RUN mkdir /octave
 ---> Using cache
 ---> a2d278b2819b
Step 6 : RUN mkdir /octave/libs
 ---> Using cache
 ---> 65efbbe01c99
Step 7 : RUN mkdir /octave/libs/jsonlab
 ---> Using cache
 ---> e41b80901266
Step 8 : COPY ~/octave/jsonlab/loadjson.m /octave/libs/jsonlab/.
INFO[0000] ~/octave/jsonlab/loadjson.m: no such file or directory 



< Docker绝对拒绝将此文件从主机复制到映像中。不用说文件loadjson.m存在(猫显示),我所有更改路径(相对,绝对等)的尝试都失败了。有什么建议为什么这个简单的任务有问题?

Docker absolutely refuses to copy this file from the host into the image. Needless to say a the file loadjson.m is there (cat displays), all my attempts to change the path (relative, absolute, etc.) failed. Any advice why this simple task is problematic?

推荐答案

在我最初写这篇文章的时候,Docker没有扩展〜或$家。现在,它在构建上下文中进行了一些扩展,但是即使如此,它们也可能不是您想要的-它们不是上下文之外的主目录。您需要显式引用该文件,或相对于Dockerfile本身打包该文件。

At the time I originally wrote this, Docker didn’t expand ~ or $HOME. Now it does some expansions inside the build context, but even so they are probably not what you want—they aren’t your home directory outside the context. You need to reference the file explicitly, or package it relative to the Dockerfile itself.

这篇关于Dockerfile COPY指令失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆