在Dockerfile中的容器内复制文件 [英] Copy file(s) within the container in Dockerfile

查看:80
本文介绍了在Dockerfile中的容器内复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在docker-compose构建过程中,如何将文件从容器内的路径复制到Dockerfile中同一容器内的不同路径 ?

How can I copy a file from a path within the container to a different path within that same container in a Dockerfile during the docker-compose build process?

COPY <src> <dest>

这将从容器外部的主机复制文件.我不知道如何< src> 指定要复制的容器内的文件.

This copies a file from the host outside the container. I don't know how to have <src> specify a file inside the container to copy.

推荐答案

@tkausl和@JohnKugelman指出可以使用以下命令语法复制文件:

as @tkausl and @JohnKugelman pointed out files can be copied by the following command syntax:

RUN cp <src-path-within-the-container> <dest-path-within-the-container>

这篇关于在Dockerfile中的容器内复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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