diff --git a/docker/utils/ports.py b/docker/utils/ports.py index bf7d6972..cf5987c9 100644 --- a/docker/utils/ports.py +++ b/docker/utils/ports.py @@ -3,10 +3,10 @@ import re PORT_SPEC = re.compile( "^" # Match full string "(" # External part - "((?P[a-fA-F\d.:]+):)?" # Address - "(?P[\d]*)(-(?P[\d]+))?:" # External range + r"((?P[a-fA-F\d.:]+):)?" # Address + r"(?P[\d]*)(-(?P[\d]+))?:" # External range ")?" - "(?P[\d]+)(-(?P[\d]+))?" # Internal range + r"(?P[\d]+)(-(?P[\d]+))?" # Internal range "(?P/(udp|tcp))?" # Protocol "$" # Match full string )