diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-08 21:35:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 21:35:52 +0100 |
commit | ba36d790db0a847274d6b4578a3fe65a517b5164 (patch) | |
tree | 8993b3effbd15425844229a8b7474ff134f30f12 | |
parent | b386d23bf01a1f3b0a604468803189625ef7b902 (diff) | |
parent | d1878cc6752bde5a9565c2468ec003125dae0c84 (diff) | |
download | podman-ba36d790db0a847274d6b4578a3fe65a517b5164.tar.gz podman-ba36d790db0a847274d6b4578a3fe65a517b5164.tar.bz2 podman-ba36d790db0a847274d6b4578a3fe65a517b5164.zip |
Merge pull request #9665 from psgreco/master-checkexistentvolumes
[NO TESTS NEEDED] Compat API: Avoid trying to create volumes if they already exist
-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) |