使用ADD命令将目录复制到Docker的其他目录(Copy directory to other directory at Docker using ADD command)

编程入门 行业动态 更新时间:2024-10-27 11:17:22
使用ADD命令将目录复制到Docker的其他目录(Copy directory to other directory at Docker using ADD command)

我已经阅读http://docs.docker.com/engine/reference/builder/#add但是我遇到了一个问题。 我想把本地目录复制到docker /user/local/

我试过了:

ADD go /usr/local/

和:

ADD /go/ /usr/local/

也:

RUN chmod 0755 /usr/local/go/src/make.bash

但是,我看到以下错误消息/usr/local/go/src/make.bash: No such file or directory但是本地go目录包含make.bash 。

I have read http://docs.docker.com/engine/reference/builder/#add however I met a problem. I want to copy the local directory go to docker /user/local/

I tried:

ADD go /usr/local/

and:

ADD /go/ /usr/local/

also:

RUN chmod 0755 /usr/local/go/src/make.bash

However, I see the following error message /usr/local/go/src/make.bash: No such file or directory but the local go directory does contain make.bash.

最满意答案

ADD go /usr/local/

将您的本地go目录的内容复制到您的码头图像的/usr/local/目录中。

要将目录本身复制到/usr/local/ use中:

ADD go /usr/local/go

要么

COPY go /usr/local/go ADD go /usr/local/

will copy the contents of your local go directory in the /usr/local/ directory of your docker image.

To copy the go directory itself in /usr/local/ use:

ADD go /usr/local/go

or

COPY go /usr/local/go

更多推荐

本文发布于:2023-08-02 07:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1372158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目录   命令   ADD   Docker   command

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!