Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rm_volume_fail' into 'huawei-1.11.2'
Fix duplicate mount point for `--volumes-from` in `docker run` This fix tries to fix the issue raised in 21845. The issue with 21845 is that if multiple `--volumes-from` with the same destination has been specified, then one volume will be overridden by the other. This will mess up with volumes reference and prevent the overridden volume from being removed at the end. Issue 21845 was observed with `docker-compose` though it is possible to emulate the same behavior with `docker` alone: ``` $ cat Dockerfile FROM busybox VOLUME ["/tmp/data"] $ docker build -t vimage . $ docker run --name=data1 vimage true $ docker run --name=data2 vimage true $ docker run --name=app --volumes-from=data1 --volumes-from=data2 -d busybox top $ docker rm -f -v $(docker ps -aq) $ docker volume ls $ docker volume rm ... ``` NOTE: Second case: ``` $ cat Dockerfile FROM busybox VOLUME ["/tmp/data"] $ docker build -t vimage . $ docker run --name=data1 vimage true $ docker run --name=data2 vimage true $ docker run --name=app --volumes-from=data1 --volumes-from=data2 -v /tmp/data:/tmp/data -d busybox top $ docker rm -f -v $(docker ps -aq) $ docker volume ls $ docker volume rm ... ``` NOTE: Third case: Combination of --volumes-from and `HostConfig.Mounts` (API only) This fix tries to address the issue by return an error if duplicate mount points was used with `--volumes-from`. An integration test has been added. This fix fixes 21845. cherry-picked from upstream moby#29563 Fix issue moby#338 Fix DTS2017070606746 note: Our code does not support API HostConfig.Mounts, so i delete the test case of third case. Signed-off-by: Yong Tang <[email protected]> Signed-off-by: Fengtu Wang <[email protected]> Conflicts: daemon/volumes.go integration-cli/docker_cli_volume_test.go See merge request docker/docker!661
- Loading branch information