From ede2db996b9f0fa6312e46ddf3293ed9809e8aae Mon Sep 17 00:00:00 2001 From: cblmemo Date: Wed, 21 Aug 2024 16:57:57 -0700 Subject: [PATCH 1/5] fix --- sky/provision/docker_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sky/provision/docker_utils.py b/sky/provision/docker_utils.py index e989fbc085a..7bfa1724b83 100644 --- a/sky/provision/docker_utils.py +++ b/sky/provision/docker_utils.py @@ -110,8 +110,8 @@ def docker_start_cmds( '--cap-add=SYS_ADMIN', '--device=/dev/fuse', '--security-opt=apparmor:unconfined', + '--entrypoint=/bin/bash', image, - 'bash', ] return ' '.join(docker_run) From 24cf958b93ffc17c175f8a9ef81b0abfa86d57f9 Mon Sep 17 00:00:00 2001 From: cblmemo Date: Fri, 23 Aug 2024 13:20:00 -0700 Subject: [PATCH 2/5] fix in cmd runner as well --- sky/skylet/providers/command_runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sky/skylet/providers/command_runner.py b/sky/skylet/providers/command_runner.py index 06c5d6d48af..4f66ef54383 100644 --- a/sky/skylet/providers/command_runner.py +++ b/sky/skylet/providers/command_runner.py @@ -65,8 +65,8 @@ def docker_start_cmds( '--cap-add=SYS_ADMIN', '--device=/dev/fuse', '--security-opt=apparmor:unconfined', + '--entrypoint=/bin/bash', image, - 'bash', ] return ' '.join(docker_run) From 94803dc119c66d6bd00d73a11ac73b9c429a5332 Mon Sep 17 00:00:00 2001 From: cblmemo Date: Mon, 26 Aug 2024 16:06:04 -0700 Subject: [PATCH 3/5] add comment in docs --- docs/source/examples/docker-containers.rst | 6 ++++++ sky/provision/runpod/utils.py | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/source/examples/docker-containers.rst b/docs/source/examples/docker-containers.rst index 582db94ee79..88d314828ea 100644 --- a/docs/source/examples/docker-containers.rst +++ b/docs/source/examples/docker-containers.rst @@ -161,6 +161,12 @@ Any GPUs assigned to the task will be automatically mapped to your Docker contai 2. The container image must grant sudo permissions without requiring password authentication for the user. Having a root user is also acceptable. +.. note:: + + When used as a runtime environment, the container's entrypoint will be + override by :code:`/bin/bash`. If you need to run a specific command, you can + do so in the :code:`setup` and :code:`run` sections of the task YAML file. + Private Registries ^^^^^^^^^^^^^^^^^^ diff --git a/sky/provision/runpod/utils.py b/sky/provision/runpod/utils.py index 24af263f13c..ff202f74fc4 100644 --- a/sky/provision/runpod/utils.py +++ b/sky/provision/runpod/utils.py @@ -77,7 +77,11 @@ def list_instances() -> Dict[str, Dict[str, Any]]: info['name'] = instance['name'] info['port2endpoint'] = {} - if instance['desiredStatus'] == 'RUNNING' and instance.get('runtime'): + # Sometimes when the cluster is in the process of being created, + # the `port` field in the runtime is None and we need to check for it. + if (instance['desiredStatus'] == 'RUNNING' and + instance.get('runtime') and + instance.get('runtime').get('ports')): for port in instance['runtime']['ports']: if port['isIpPublic']: if port['privatePort'] == 22: @@ -138,6 +142,7 @@ def launch(name: str, instance_type: str, region: str, disk_size: int, if ports is not None: custom_ports_str = ''.join([f'{p}/tcp,' for p in ports]) + new_instance = runpod.runpod.create_pod( name=name, image_name=image_name, @@ -154,7 +159,7 @@ def launch(name: str, instance_type: str, region: str, disk_size: int, f'{constants.SKY_REMOTE_RAY_PORT}/http'), support_public_ip=True, docker_args= - f'bash -c \'echo {encoded} | base64 --decode > init.sh; bash init.sh\'') + f'-c \'echo {encoded} | base64 --decode > init.sh; bash init.sh\'') return new_instance['id'] From cf73a5245108148522865ea07b1995cf6759f203 Mon Sep 17 00:00:00 2001 From: cblmemo Date: Mon, 26 Aug 2024 16:09:43 -0700 Subject: [PATCH 4/5] revert unwanted changes --- sky/provision/runpod/utils.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sky/provision/runpod/utils.py b/sky/provision/runpod/utils.py index ff202f74fc4..24af263f13c 100644 --- a/sky/provision/runpod/utils.py +++ b/sky/provision/runpod/utils.py @@ -77,11 +77,7 @@ def list_instances() -> Dict[str, Dict[str, Any]]: info['name'] = instance['name'] info['port2endpoint'] = {} - # Sometimes when the cluster is in the process of being created, - # the `port` field in the runtime is None and we need to check for it. - if (instance['desiredStatus'] == 'RUNNING' and - instance.get('runtime') and - instance.get('runtime').get('ports')): + if instance['desiredStatus'] == 'RUNNING' and instance.get('runtime'): for port in instance['runtime']['ports']: if port['isIpPublic']: if port['privatePort'] == 22: @@ -142,7 +138,6 @@ def launch(name: str, instance_type: str, region: str, disk_size: int, if ports is not None: custom_ports_str = ''.join([f'{p}/tcp,' for p in ports]) - new_instance = runpod.runpod.create_pod( name=name, image_name=image_name, @@ -159,7 +154,7 @@ def launch(name: str, instance_type: str, region: str, disk_size: int, f'{constants.SKY_REMOTE_RAY_PORT}/http'), support_public_ip=True, docker_args= - f'-c \'echo {encoded} | base64 --decode > init.sh; bash init.sh\'') + f'bash -c \'echo {encoded} | base64 --decode > init.sh; bash init.sh\'') return new_instance['id'] From eaf6dfda9ff1027cf90dd032dcae67f814507830 Mon Sep 17 00:00:00 2001 From: cblmemo Date: Mon, 26 Aug 2024 21:00:19 -0700 Subject: [PATCH 5/5] add runpod explanation --- docs/source/examples/docker-containers.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/source/examples/docker-containers.rst b/docs/source/examples/docker-containers.rst index 88d314828ea..408a53a6185 100644 --- a/docs/source/examples/docker-containers.rst +++ b/docs/source/examples/docker-containers.rst @@ -163,9 +163,12 @@ Any GPUs assigned to the task will be automatically mapped to your Docker contai .. note:: - When used as a runtime environment, the container's entrypoint will be - override by :code:`/bin/bash`. If you need to run a specific command, you can - do so in the :code:`setup` and :code:`run` sections of the task YAML file. + Using a container with a customized entrypoint as a runtime environment is + supported, with the container's entrypoint being overridden by :code:`/bin/bash`. + Specific commands can be executed in the :code:`setup` and :code:`run` sections + of the task YAML file. However, this approach is not compatible with RunPod due + to limitations in the RunPod API, so ensure that you choose a container with a + default entrypoint (i.e. :code:`/bin/bash`). Private Registries ^^^^^^^^^^^^^^^^^^