diff options
author | Pablo Greco <pgreco@centosproject.org> | 2021-03-08 12:14:52 -0300 |
---|---|---|
committer | Pablo Greco <pgreco@centosproject.org> | 2021-03-08 15:18:42 -0300 |
commit | d1878cc6752bde5a9565c2468ec003125dae0c84 (patch) | |
tree | 8993b3effbd15425844229a8b7474ff134f30f12 /cmd/podman | |
parent | b386d23bf01a1f3b0a604468803189625ef7b902 (diff) | |
download | podman-d1878cc6752bde5a9565c2468ec003125dae0c84.tar.gz podman-d1878cc6752bde5a9565c2468ec003125dae0c84.tar.bz2 podman-d1878cc6752bde5a9565c2468ec003125dae0c84.zip |
Compat API: Avoid trying to create volumes if they already exist
Fixes commit: 53d22c779c5d2df5ccda5a8e23db0501a0dadf44
Signed-off-by: Pablo Greco <pgreco@centosproject.org>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create_opts.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 6c91bedfe..a296ef4f1 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -439,6 +439,10 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup if !filepath.IsAbs(vol) { continue } + // If volume already exists, there is nothing to do + if _, err := os.Stat(vol); err == nil { + continue + } if err := os.MkdirAll(vol, 0755); err != nil { if !os.IsExist(err) { return nil, nil, errors.Wrapf(err, "error making volume mountpoint for volume %s", vol) |