add host.docker.internal for inter-AWS communication mocking on linux (#4408)
This commit is contained in:
parent
e8cd02617d
commit
f451153c72
@ -6,6 +6,7 @@ from collections import defaultdict
|
|||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
from gzip import GzipFile
|
from gzip import GzipFile
|
||||||
|
from sys import platform
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
import docker.errors
|
import docker.errors
|
||||||
@ -577,6 +578,13 @@ class LambdaFunction(CloudFormationModel, DockerModel):
|
|||||||
if settings.TEST_SERVER_MODE
|
if settings.TEST_SERVER_MODE
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
|
# add host.docker.internal host on linux to emulate Mac + Windows behavior
|
||||||
|
# for communication with other mock AWS services running on localhost
|
||||||
|
if platform == "linux" or platform == "linux2":
|
||||||
|
run_kwargs["extra_hosts"] = {
|
||||||
|
"host.docker.internal": "host-gateway"
|
||||||
|
}
|
||||||
|
|
||||||
image_ref = "lambci/lambda:{}".format(self.run_time)
|
image_ref = "lambci/lambda:{}".format(self.run_time)
|
||||||
self.docker_client.images.pull(":".join(parse_image_ref(image_ref)))
|
self.docker_client.images.pull(":".join(parse_image_ref(image_ref)))
|
||||||
container = self.docker_client.containers.run(
|
container = self.docker_client.containers.run(
|
||||||
|
Loading…
Reference in New Issue
Block a user