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

问题描述 投票:0回答:1

我需要在几种不同的操作系统类型上测试我的团队软件,我决定利用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
docker ubuntu centos dockerfile redhat
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.