Skip to content

[Autoscaler] Reject colons in Docker bind-mount cluster names - #68618

Open
rangelml wants to merge 1 commit into
ray-project:masterfrom
rangelml:fix/autoscaler-docker-cluster-name
Open

rangelml wants to merge 1 commit into
ray-project:masterfrom
rangelml:fix/autoscaler-docker-cluster-name

Conversation

@rangelml

Copy link
Copy Markdown

Description

Why are these changes needed?

The Docker autoscaler uses the cluster name in the host path of a -v bind mount. Docker parses a colon in that name as a mount separator and fails when starting the container. Report an actionable config error before provisioning when user file mounts or the default token mount need a bind mount.

Related issues

Related issue number

Closes #45189

The issue is unassigned. Searches for the issue number and Docker cluster-name and bind-mount keywords found no competing open PR.

Additional information

  • The two invalid configurations passed validation on upstream/master and raised the expected error with the fix. The regression also covers configurations that can use a colon without a bind mount.

  • The autoscaler utility and command runner test files passed (19 tests). From the checkout, with the matching Ray wheel installed, the command was:

    ../.venv/bin/python -c 'import sys; from pathlib import Path; import ray; ray.__path__.insert(0, str(Path("python/ray").resolve())); import pytest; sys.exit(pytest.main(sys.argv[1:]))' -q python/ray/tests/test_autoscaler_util.py python/ray/tests/test_command_runner.py
  • Ruff, Black, and the applicable pre-commit hooks passed.

AI assistance was used for triage, implementation, and testing.

@rangelml
rangelml requested a review from a team as a code owner November 28, 2026 03:16

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces validation to prevent the use of colons (":") in the cluster name when Docker bind mounts are active, which prevents potential Docker startup failures. The reviewer suggests extending this validation to also cover "head_file_mounts" and "worker_file_mounts" since they are also bind-mounted, and updating the corresponding unit tests to include these scenarios.

Comment on lines +48 to +50
has_mounts = bool(config.get("file_mounts")) or (
config.get("auth_mode", "token") == "token"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In addition to file_mounts, Ray also supports head_file_mounts and worker_file_mounts which are bind-mounted into the Docker container. If a user specifies either of these while file_mounts is empty and auth_mode is "disabled", the validation check will be bypassed, leading to the same Docker startup failure when the cluster name contains a colon. We should include these in the has_mounts check.

    has_mounts = (
        bool(config.get("file_mounts"))
        or bool(config.get("head_file_mounts"))
        or bool(config.get("worker_file_mounts"))
        or (config.get("auth_mode", "token") == "token")
    )

Comment on lines +8 to +11
@pytest.mark.parametrize(
"mount_config",
[{"auth_mode": "disabled", "file_mounts": {"/home/ray/path": "."}}, {}],
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Update the test parametrization to cover head_file_mounts and worker_file_mounts to ensure that the validation correctly rejects colons in the cluster name when these types of mounts are used.

@pytest.mark.parametrize(
    "mount_config",
    [
        {"auth_mode": "disabled", "file_mounts": {"/home/ray/path": "."}},
        {"auth_mode": "disabled", "head_file_mounts": {"/home/ray/path": "."}},
        {"auth_mode": "disabled", "worker_file_mounts": {"/home/ray/path": "."}},
        {},
    ],
)

@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ray Cluster] Colon in cluster_name breaks file_mounts directive

1 participant