简体   繁体   中英

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

I need to test out my teams software on a couple different OS types and I decided to leverage Docker to help.

What I essentially want to do is have a tree of our repo checked out in some central location. I then want have several containers of different os types that all copy that git tree into their root folder when they are built. The reason for this is that I want all containers testing the same patch of software always.

Here is how I set up my docker container directory structure:

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)

So as you can see, each container type has a symbolic link pointing back to the main directory where my git tree is checked out. For each instance, in the Dockerfile there is a line COPY git_tree / . I try copying the symbolic link to the root dir of the new container and I get the following error everytime:

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吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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