Skip to content

Commit

Permalink
Create non-existing binding volumes
Browse files Browse the repository at this point in the history
Ideally, this would be done by podman, but in the mean time do it in
podman-compose for a better user experience.

Fixes containers#185

Signed-off-by: Luiz Carvalho <[email protected]>
  • Loading branch information
lcarva committed Nov 23, 2021
1 parent e879529 commit 7a433b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ def parse_short_mount(mount_str, basedir):
mount_type = "bind"
# TODO: should we use os.path.realpath(basedir)?
mount_src = os.path.join(basedir, os.path.expanduser(mount_src))
try:
os.makedirs(mount_src, exist_ok=True)
except FileExistsError:
# This error may occur if mount_src is a path to an existing file. If
# it's an existing directory, an exception is not raised.
pass
else:
# Named volume
# - datavolume:/var/lib/mysql
Expand Down

0 comments on commit 7a433b7

Please sign in to comment.