Skip to content

Commit 4fbf61a

Browse files
committed
port binding
1 parent 46fb5e2 commit 4fbf61a

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

localstack_utils/container.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323
class Container:
2424
@staticmethod
2525
def create_localstack_container(
26-
pull_new_image,
27-
image_name,
28-
image_tag,
29-
gateway_listen,
30-
environment_variables,
26+
pull_new_image: bool,
27+
image_name: str,
28+
image_tag: str,
29+
gateway_listen: str,
30+
environment_variables: dict,
31+
bind_ports: dict,
3132
):
3233
environment_variables = environment_variables or {}
3334
environment_variables["GATEWAY_LISTEN"] = gateway_listen
@@ -39,16 +40,17 @@ def create_localstack_container(
3940
else False
4041
)
4142

42-
port = gateway_listen.split(":")[1]
43-
full_port_edge = {port: port}
43+
bind_ports = bind_ports or {}
44+
gateway_port = gateway_listen.split(":")[1]
45+
bind_ports.update({gateway_port: gateway_port})
4446

4547
if pull_new_image or not image_exists:
4648
logging.info("Pulling latest image")
4749
DOCKER_CLIENT.images.pull(image_name_or_default, image_tag)
4850

4951
return DOCKER_CLIENT.containers.run(
5052
image_name_or_default,
51-
ports=full_port_edge,
53+
ports=bind_ports,
5254
environment=environment_variables,
5355
detach=True,
5456
)

0 commit comments

Comments
 (0)