Skip to content

Commit cee900a

Browse files
committed
fix: use ECR-hosted image for ubuntu:16.04
1 parent c42aaaa commit cee900a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/data/multimodel/container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:16.04
1+
FROM 142577830533.dkr.ecr.us-west-2.amazonaws.com/ubuntu:16.04
22

33
# Set a docker label to advertise multi-model support on the container
44
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true

tests/integ/test_multidatamodel.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,26 @@ def container_image(sagemaker_session):
4646
algorithm_name = unique_name_from_base("sagemaker-multimodel-integ-test")
4747
ecr_image = _ecr_image_uri(sagemaker_session, algorithm_name)
4848

49-
# Build and tag docker image locally
49+
ecr_client = sagemaker_session.boto_session.client("ecr")
50+
username, password = _ecr_login(ecr_client)
51+
5052
docker_client = docker.from_env()
53+
54+
# Base image pull
55+
base_image = "142577830533.dkr.ecr.us-west-2.amazonaws.com/ubuntu:16.04"
56+
docker_client.images.pull(base_image, auth_config={"username": username, "password": password})
57+
58+
# Build and tag docker image locally
5159
image, build_log = docker_client.images.build(
52-
path=os.path.join(DATA_DIR, "multimodel", "container"), tag=algorithm_name, rm=True
60+
path=os.path.join(DATA_DIR, "multimodel", "container"),
61+
tag=algorithm_name,
62+
rm=True,
5363
)
5464
image.tag(ecr_image, tag="latest")
5565

5666
# Create AWS ECR and push the local docker image to it
57-
ecr_client = sagemaker_session.boto_session.client("ecr")
5867
_create_repository(ecr_client, algorithm_name)
5968

60-
username, password = _ecr_login(ecr_client)
6169
# Retry docker image push
6270
for _ in retries(3, "Upload docker image to ECR repo", seconds_to_sleep=10):
6371
try:

0 commit comments

Comments
 (0)