繁体   English   中英

Docker - 将主机上外部位置的文件复制到容器中

[英]Docker - Copy files from external locations on host machine into containers

我需要在几种不同的操作系统类型上测试我的团队软件,我决定利用Docker来提供帮助。

我本来想要做的是在我们的某个中心位置检查一张我们的仓库树。 然后我想要几个不同的os类型的容器,它们在构建时都将git树复制到它们的根文件夹中。 原因是我希望所有容器始终测试相同的软件补丁。

以下是我设置docker容器目录结构的方法:

docker_containers/
    GIT_TREE/
    container_ubuntu14/
        git_tree/ (symbolic link to ../GIT_TREE)
        build.sh  (docker build commands specific to this os type)
        Dockerfile
        run.sh (docker run commands for use post build)
    container_ubuntu18/
        git_tree/ (symbolic link to ../GIT_TREE)
        build.sh  (docker build commands specific to this os type)
        Dockerfile
        run.sh (docker run commands for use post build)
    container_centos7/
        git_tree/ (symbolic link to ../GIT_TREE)
        build.sh  (docker build commands specific to this os type)
        Dockerfile
        run.sh (docker run commands for use post build)

正如您所看到的,每个容器类型都有一个符号链接,指向我检查我的git树的主目录。 对于每个实例,在Dockerfile都有一行COPY git_tree / 我尝试将符号链接复制到新容器的根目录,每次都会出现以下错误:

COPY failed: stat /home/user/docker_fs/tmp/docker-builder474024999/home/user/docker_containers/GIT_TREE: no such file or directory

它应该是GIT_TREE而不是GIT-TREE吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM