From d1878cc6752bde5a9565c2468ec003125dae0c84 Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Mon, 8 Mar 2021 12:14:52 -0300 Subject: Compat API: Avoid trying to create volumes if they already exist Fixes commit: 53d22c779c5d2df5ccda5a8e23db0501a0dadf44 Signed-off-by: Pablo Greco --- cmd/podman/common/create_opts.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd/podman') 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) -- cgit v1.2.3-54-g00ecf