@@ -46,18 +46,26 @@ def container_image(sagemaker_session):
46
46
algorithm_name = unique_name_from_base ("sagemaker-multimodel-integ-test" )
47
47
ecr_image = _ecr_image_uri (sagemaker_session , algorithm_name )
48
48
49
- # Build and tag docker image locally
49
+ ecr_client = sagemaker_session .boto_session .client ("ecr" )
50
+ username , password = _ecr_login (ecr_client )
51
+
50
52
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
51
59
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 ,
53
63
)
54
64
image .tag (ecr_image , tag = "latest" )
55
65
56
66
# Create AWS ECR and push the local docker image to it
57
- ecr_client = sagemaker_session .boto_session .client ("ecr" )
58
67
_create_repository (ecr_client , algorithm_name )
59
68
60
- username , password = _ecr_login (ecr_client )
61
69
# Retry docker image push
62
70
for _ in retries (3 , "Upload docker image to ECR repo" , seconds_to_sleep = 10 ):
63
71
try :
0 commit comments