Skip to content

Commit 1b853fb

Browse files
committed
strip off warning messages when extracting Docker container ID from stdout
1 parent 8ae2116 commit 1b853fb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

localstack/services/awslambda/lambda_executors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def create_container(self, func_details, env_vars, lambda_cwd):
602602
env_vars["HOSTNAME"] = os.environ.get("HOSTNAME")
603603
env_vars["EDGE_PORT"] = config.EDGE_PORT
604604

605-
DOCKER_CLIENT.create_container(
605+
return DOCKER_CLIENT.create_container(
606606
image_name=docker_image,
607607
remove=True,
608608
interactive=True,

localstack/utils/docker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ def create_container(self, image_name: str, **kwargs) -> str:
249249
LOG.debug("Create container with cmd: %s", cmd)
250250
try:
251251
container_id = safe_run(cmd)
252+
# Note: strip off Docker warning messages like "DNS setting (--dns=127.0.0.1) may fail in containers"
253+
container_id = container_id.strip().split("\n")[-1]
252254
return container_id.strip()
253255
except subprocess.CalledProcessError as e:
254256
if "Unable to find image" in e.stdout.decode(config.DEFAULT_ENCODING):

0 commit comments

Comments
 (0)