Skip to content

add tini to docker files #5000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Ajay-Satish-01
Copy link
Contributor

Add tini to docker files #4750

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

Copy link
Collaborator

@aylei aylei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to skypilot @Ajay-Satish-01 ! Left some comments

@aylei
Copy link
Collaborator

aylei commented Mar 21, 2025

/quicktest-core

@Ajay-Satish-01 Ajay-Satish-01 requested a review from aylei March 23, 2025 19:05
Copy link
Collaborator

@aylei aylei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Ajay-Satish-01! BTW, when launching containers on VM and Kubernetes, the docker run and k8s pod manifest will override entrypoint:

'--entrypoint=/bin/bash',

https://github.com/skypilot-org/skypilot/blob/052e0ea3b129f208a82fd9d6bddbfd39d389e831/sky/templates/kubernetes-ray.yml.j2

Would you like to also change these in followup PRs?

@Ajay-Satish-01
Copy link
Contributor Author

For the follow-up PR, should I create a new preserve_entrypoint argument and include the command args only when we are not preserving the entry point?

@Michaelvll
Copy link
Collaborator

LGTM, thanks @Ajay-Satish-01! BTW, when launching containers on VM and Kubernetes, the docker run and k8s pod manifest will override entrypoint:

'--entrypoint=/bin/bash',

https://github.com/skypilot-org/skypilot/blob/052e0ea3b129f208a82fd9d6bddbfd39d389e831/sky/templates/kubernetes-ray.yml.j2

Would you like to also change these in followup PRs?

Should directly make the modification in this PR? It seems without changing the overwrite of entrypoint, this PR will not resolve #4750?

@Ajay-Satish-01
Copy link
Contributor Author

@aylei can you please check if this is what you are expecting?

@@ -86,14 +86,26 @@ def docker_start_cmds(
container_name,
user_options,
docker_cmd,
preserve_entrypoint=False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Ajay-Satish-01 ! My question is how this flag is determined at caller, since user may provide their own image with no proper entrypoint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if this change is what you expect. Thanks

Copy link
Collaborator

@aylei aylei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @Ajay-Satish-01 ! Left my thoughts for the entrypiont issue

Comment on lines +220 to +223
cmd = f'{self.docker_cmd} inspect --format="{{{{.Config.Entrypoint}}}}" {image}'
output = self._run(cmd, wait_for_docker_daemon=True)
# If output is [] or <nil>, the image has no entrypoint
return output != "[]" and output != "<nil>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the entrypoint exists, it might be inappropriate for sky container, e.g. most of application containers use the application binary as entrypoint.

Given this assumption, I think we can always use bash as the entrypiont, and exec tini to make tini the PID 1 process in the container if we found tini is available in the environment. I would like to follow this up and make commits to this PR later if you'd like!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants