Skip to content

Commit 9e64dd0

Browse files
committed
fix: remove sagemaker-local network before compose
1 parent da348e8 commit 9e64dd0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/sagemaker/local/image.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ def process(
227227

228228
if _ecr_login_if_needed(self.sagemaker_session.boto_session, self.image):
229229
_pull_image(self.image)
230+
231+
# Remove sagemaker-local network, compose_command will fail if an existing network is still around
232+
remove_sagemaker_local = ["docker", "network", "rm", STUDIO_HOST_NAME]
233+
remove_process = subprocess.Popen(
234+
remove_sagemaker_local, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
235+
)
236+
try:
237+
_stream_output(remove_process)
238+
except RuntimeError:
239+
# Continue even if rm sagemaker-local fails
240+
pass
230241

231242
compose_command = self._compose()
232243
process = subprocess.Popen(

0 commit comments

Comments
 (0)