1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon
Yong Tang 3599289e2c 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.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit 9526e5c6ae)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-02-22 23:37:49 -08:00
..
caps
cluster Merge pull request #31134 from thaJeztah/update-swagger 2017-02-17 22:26:43 -08:00
events Merge pull request #25800 from vdemeester/25798-fix-event-actions 2016-10-28 05:20:49 +02:00
exec Move StreamConfig out of runconfig 2016-11-14 14:03:05 -08:00
graphdriver Merge pull request #31103 from tonistiigi/update-docs-link 2017-02-17 22:05:03 -08:00
initlayer Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
links
logger Synchronize the cursor returned by followJournal 2017-02-22 17:51:27 -08:00
network Fix autostart for swarm scope connected containers 2016-09-13 14:21:58 -07:00
apparmor_default.go daemon: switch to 'ensure' workflow for AppArmor profiles 2016-12-12 16:16:50 -08:00
apparmor_default_unsupported.go daemon: switch to 'ensure' workflow for AppArmor profiles 2016-12-12 16:16:50 -08:00
archive.go Fix uneccessary calls to volume.Unmount() 2016-11-10 14:04:08 -05:00
archive_unix.go
archive_windows.go
attach.go Move errors/ to api/errors 2016-09-16 12:27:13 -04:00
auth.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
bindmount_solaris.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
bindmount_unix.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
cache.go image/cache: fix isValidParent logic 2017-02-22 14:47:09 -08:00
changes.go Windows: support docker diff 2016-10-28 11:06:54 -07:00
checkpoint.go Restrict checkpoint name to prevent directory traversal 2016-11-28 11:17:55 -08:00
cluster.go add docker network prune 2016-10-25 06:43:54 +00:00
commit.go commit: do not change container labels on commit 2017-01-04 12:42:42 +01:00
config.go Rename Remote API to Engine API 2016-11-22 16:49:58 -08:00
config_common_unix.go Add expected 3rd party binaries commit ids to info 2016-11-09 07:42:44 -08:00
config_experimental.go Make experimental a runtime flag 2016-10-24 15:20:01 -07:00
config_solaris.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
config_test.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
config_unix.go Rename Remote API to Engine API 2016-11-22 16:49:58 -08:00
config_unix_test.go fix config load error with ulimits 2016-10-17 18:48:40 +08:00
config_windows.go Add expected 3rd party binaries commit ids to info 2016-11-09 07:42:44 -08:00
config_windows_test.go fix config load error with ulimits 2016-10-17 18:48:40 +08:00
container.go xFix issue for --hostname when running in "--net=host" 2016-12-09 14:42:16 -08:00
container_operations.go xFix issue for --hostname when running in "--net=host" 2016-12-09 14:42:16 -08:00
container_operations_solaris.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
container_operations_unix.go plugins: support for devices 2016-11-22 16:16:33 -08:00
container_operations_windows.go Windows: Factor out unused fields in container 2016-10-13 14:51:10 -07:00
create.go xFix issue for --hostname when running in "--net=host" 2016-12-09 14:42:16 -08:00
create_unix.go Add new HostConfig field, Mounts. 2016-09-13 09:55:35 -04:00
create_windows.go Windows: Revert 27884 2016-11-18 13:36:37 -08:00
daemon.go Merge pull request #30331 from vieux/1.13.1-rc1-cherrypicks 2017-01-26 19:21:38 -08:00
daemon_experimental.go move plugins out of experimental 2016-11-10 15:51:32 -08:00
daemon_linux.go
daemon_linux_test.go
daemon_solaris.go Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
daemon_test.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
daemon_unix.go do not create init-dir if not needed 2017-01-24 17:00:52 -08:00
daemon_unix_test.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
daemon_unsupported.go
daemon_windows.go Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
debugtrap.go Reduce spew data dumped 2016-11-18 13:32:26 -08:00
debugtrap_unix.go Spew debugging 2016-11-03 10:05:11 -07:00
debugtrap_unsupported.go Spew debugging 2016-11-03 10:05:11 -07:00
debugtrap_windows.go Spew debugging 2016-11-03 10:05:11 -07:00
delete.go Rename Remote API to Engine API 2016-11-22 16:49:58 -08:00
delete_test.go make client side know container removal in progress 2016-09-27 18:06:54 +08:00
discovery.go validate heartbeat in discovery cluster opts 2016-09-01 01:07:05 +08:00
discovery_test.go validate heartbeat in discovery cluster opts 2016-09-01 01:07:05 +08:00
disk_usage.go Add reference filter and deprecated filter param… 2016-11-11 15:34:01 +01:00
errors.go Move errors/ to api/errors 2016-09-16 12:27:13 -04:00
events.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
events_test.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
exec.go Rename Remote API to Engine API 2016-11-22 16:49:58 -08:00
exec_linux.go Remove hacked Windows OCI spec, compile fixups 2016-09-27 12:07:35 -07:00
exec_solaris.go
exec_windows.go Windows: Plumb through user 2016-11-08 17:41:56 -08:00
export.go pkg/archive: remove unnecessary Archive and Reader type 2016-10-20 19:31:24 -07:00
getsize_unix.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
health.go Use Container.Config.Shell instead of hardcoded… 2016-11-19 23:45:58 -08:00
health_test.go Fix deadlock on cancelling healthcheck 2016-11-18 13:37:44 -08:00
image.go Deprecate repo:shortid syntax 2016-10-06 17:12:17 -07:00
image_delete.go Add basic prometheus support 2016-10-27 10:34:38 -07:00
image_exporter.go
image_history.go Add basic prometheus support 2016-10-27 10:34:38 -07:00
image_inspect.go Inspect populate image OSVersion 2016-10-06 11:46:24 -07:00
image_pull.go Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
image_push.go Implement content addressability for plugins 2016-12-27 13:31:14 -08:00
image_tag.go Generalize content addressable and reference storage 2016-09-15 18:08:19 -07:00
images.go Ensure proper value is used when computing reclaimable space 2017-01-24 15:41:06 -08:00
import.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
info.go api: types: keep info.SecurityOptions a string slice 2016-11-21 14:45:05 -08:00
info_unix.go api: types: keep info.SecurityOptions a string slice 2016-11-21 14:45:05 -08:00
info_windows.go api: types: keep info.SecurityOptions a string slice 2016-11-21 14:45:05 -08:00
inspect.go record pid of exec'd process 2016-10-20 17:06:11 +02:00
inspect_solaris.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
inspect_unix.go Add new HostConfig field, Mounts. 2016-09-13 09:55:35 -04:00
inspect_windows.go Add new HostConfig field, Mounts. 2016-09-13 09:55:35 -04:00
keys.go
keys_unsupported.go
kill.go Taking stop-signal into account when docker kill 2016-10-24 11:10:14 -07:00
links.go Windows: Factor out sqlite 2016-12-02 13:40:06 -08:00
links_linux.go Windows: Factor out sqlite 2016-12-02 13:40:06 -08:00
links_linux_test.go Windows: Factor out sqlite 2016-12-02 13:40:06 -08:00
links_notlinux.go Windows: Factor out sqlite 2016-12-02 13:40:06 -08:00
list.go Replace all "Filter" field with "Filters" for consistency 2016-11-01 23:09:30 +08:00
list_unix.go
list_windows.go
logdrivers_linux.go added logentries driver 2016-10-06 22:48:53 -03:00
logdrivers_windows.go Windows: Enable fluentd logdriver 2016-11-08 19:54:57 -08:00
logs.go Merge pull request #30223 from mlaventure/fix-logwatcher-deadlock 2017-02-17 22:04:30 -08:00
logs_test.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
metrics.go Add basic prometheus support 2016-10-27 10:34:38 -07:00
monitor.go Move StreamConfig out of runconfig 2016-11-14 14:03:05 -08:00
monitor_linux.go
monitor_solaris.go
monitor_windows.go Move stdio attach from libcontainerd backend to callback 2016-10-24 00:20:36 -07:00
mounts.go Add new HostConfig field, Mounts. 2016-09-13 09:55:35 -04:00
names.go Restrict checkpoint name to prevent directory traversal 2016-11-28 11:17:55 -08:00
network.go Remove attachable network on swarm leave 2017-01-26 04:31:34 -08:00
oci_linux.go do not require custom build of tini 2017-01-24 16:31:39 -08:00
oci_solaris.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
oci_windows.go Windows: Unify workdir handling 2017-02-03 00:40:46 -08:00
pause.go
prune.go Convert DanglingOnly to Filters for docker image prune 2016-12-07 16:08:18 -08:00
rename.go Fix docker rename with linked containers 2016-06-27 19:58:05 -07:00
resize.go
restart.go Allow providing a custom storage directory for docker checkpoints 2016-10-28 07:56:05 -04:00
search.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
search_test.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
seccomp_disabled.go Replace old oci specs import with runtime-specs 2016-08-17 09:38:34 -07:00
seccomp_linux.go daemon: add a flag to override the default seccomp profile 2016-11-02 21:41:29 +01:00
seccomp_unsupported.go Fix seccomp output in docker info 2016-07-08 17:26:42 -07:00
secrets.go do not force target type for secret references 2016-11-21 14:45:39 -08:00
secrets_linux.go secrets: secret management for swarm 2016-11-09 14:27:43 -05:00
secrets_unsupported.go secrets: secret management for swarm 2016-11-09 14:27:43 -05:00
selinux_linux.go
selinux_unsupported.go
start.go fix #29199, reset container if container start failed 2016-12-07 16:16:55 -08:00
start_unix.go Add functional support for Docker sub commands on Solaris 2016-11-07 09:06:34 -08:00
start_windows.go Swarm-mode overlay networking support for windows 2016-11-10 09:54:40 -08:00
stats.go Merge pull request #29702 from WeiZhang555/stats-all-format-name-panic 2017-02-17 22:15:04 -08:00
stats_collector.go Merge pull request #29702 from WeiZhang555/stats-all-format-name-panic 2017-02-17 22:15:04 -08:00
stats_collector_solaris.go
stats_collector_unix.go Windows: stats support 2016-09-16 11:56:15 -07:00
stats_collector_windows.go Windows: stats support 2016-09-16 11:56:15 -07:00
stats_unix.go Removed engine-api leftovers 2016-09-21 12:36:52 +02:00
stats_windows.go Windows: stats support 2016-09-16 11:56:15 -07:00
stop.go Update docker stop and docker restart to allow not specifying timeout and use the one specified at container creation time. 2016-10-17 12:53:35 -07:00
top_unix.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
top_unix_test.go Validate arguments for ps in docker top 2016-07-08 05:58:11 +00:00
top_windows.go Windows: docker top implementation 2016-09-07 16:29:02 -07:00
unpause.go remove running judgement when unpause container 2016-08-29 10:16:18 +08:00
update.go Fix update clear the restart policy of monitor 2017-01-04 12:44:55 +01:00
update_linux.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
update_solaris.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
update_windows.go Add engine-api types to docker 2016-09-07 11:05:58 -07:00
volumes.go Fix duplicate mount point for --volumes-from in docker run 2017-02-22 23:37:49 -08:00
volumes_unit_test.go
volumes_unix.go close the file 2016-11-21 13:23:23 -08:00
volumes_windows.go Remove hacked Windows OCI spec, compile fixups 2016-09-27 12:07:35 -07:00
wait.go
workdir.go COPY file . after WORKDIR (now always created) 2016-11-28 11:12:45 -08:00