fix: finch linux rootless containerd detection#8650
Open
robbrad wants to merge 13 commits intoaws:developfrom
Open
fix: finch linux rootless containerd detection#8650robbrad wants to merge 13 commits intoaws:developfrom
robbrad wants to merge 13 commits intoaws:developfrom
Conversation
Updated LinuxHandler.get_finch_socket_path() to check multiple standard socket locations instead of using a hardcoded path.
Added comprehensive tests for all socket detection scenarios on Linux.
reedham-aws
reviewed
Feb 12, 2026
Contributor
There was a problem hiding this comment.
One thing that needs to be modified in this PR is actually where we're collecting metrics:
aws-sam-cli/samcli/lib/telemetry/metric.py
Lines 543 to 572 in b9aa1ab
You can see that we determine container engine based on the socket path. Anything that has
finch.sock will be labeled as finch, but the containerd.sock will fall through to unknown. The part I don't quite understand is how we'd categorize containerd here; correct me if I'm wrong, but I don't think this is really a finch specific socket, so it doesn't really fit in that bucket. I left another comment on the PR to that effect.
On another note, I haven't fully reviewed the tests either, I can get to those later. There's also some formatting errors, but those could probably be cleaned up with make format or make lint.
| # Rootless containerd socket (most common on Linux) | ||
| containerd_sock = os.path.join(xdg_runtime_dir, "containerd", "containerd.sock") | ||
| if os.path.exists(containerd_sock): | ||
| LOG.debug(f"Found Finch socket at XDG_RUNTIME_DIR: {containerd_sock}") |
Contributor
There was a problem hiding this comment.
Is the containerd_sock exclusively for finch, though? Couldn't other container clients/engines be using this socket?
|
|
||
| # Default fallback to system socket | ||
| return "unix:///var/run/finch.sock" | ||
| Returns the socket path for Linux, checking multiple locations. |
There was a problem hiding this comment.
needs integ test to check builds work too in rootless mode?
Update based on PR review comments
Rearranged the priority order for socket path checks and updated comments for clarity regarding Finch and containerd socket usage.
Add test for finch.sock preference over containerd.sock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes Finch detection on Linux systems using rootless containerd by checking multiple standard socket locations instead of using a hardcoded path.
Which issue(s) does this change fix?
fixes #8649
Problem
SAM CLI fails with "No container runtime available" on Linux with rootless containerd despite Finch being installed and working. The issue is that SAM CLI only checks
/var/run/finch.sock, but rootless containerd uses$XDG_RUNTIME_DIR/containerd/containerd.sock.Solution
Updated
LinuxHandler.get_finch_socket_path()to check multiple locations in priority order:$XDG_RUNTIME_DIR/containerd/containerd.sock(rootless containerd)$XDG_RUNTIME_DIR/finch.sock(Finch-specific)~/.finch/finch.sock(user home directory)/var/run/finch.sock(system-wide fallback)Nonewhen no socket found (enables future CLI fallback)Changes
samcli/local/docker/platform_config.pyTesting
Risk
LOW - Only affects Linux socket detection, no changes to macOS or Windows
Related Issues
Fixes issue where SAM CLI fails to detect Finch on Linux with rootless containerd.
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.