From c25d6eaf484ccc828fe944909a004450c175e859 Mon Sep 17 00:00:00 2001 From: Tian Xia Date: Mon, 26 Aug 2024 21:05:15 -0700 Subject: [PATCH] [Core] Enable use docker image w/ non-default entrypoint as runtime env (#3867) * fix * fix in cmd runner as well * add comment in docs * revert unwanted changes * add runpod explanation --- docs/source/examples/docker-containers.rst | 9 +++++++++ sky/provision/docker_utils.py | 2 +- sky/skylet/providers/command_runner.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/source/examples/docker-containers.rst b/docs/source/examples/docker-containers.rst index 582db94ee79..408a53a6185 100644 --- a/docs/source/examples/docker-containers.rst +++ b/docs/source/examples/docker-containers.rst @@ -161,6 +161,15 @@ 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:: + + 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 ^^^^^^^^^^^^^^^^^^ 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) 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)