Skip to content

[Bug]: --ssh flag doesn't work with non-root user #580

@jglogan

Description

@jglogan

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Dockerfile:

FROM alpine:latest
RUN addgroup -S nonroot \
&&  adduser -S -G nonroot -h /home/nonroot nonroot \
&&  apk add openssh-client git
USER nonroot
WORKDIR /home/nonroot

Current behavior

% container run -it --rm --ssh test sh   
Warning! Running debug build. Performance may be degraded.
~ $ git clone [email protected]:apple/containerization.git
Cloning into 'containerization'...
The authenticity of host 'github.com (140.82.112.3)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
~ $ ls -l ${SSH_AUTH_SOCK}
s---------    1 root     root             0 Sep  5 14:57 /run/host-services/ssh-auth.sock

Expected behavior

git clone should work.

Environment

- OS: 26 beta
- Xcode: 26 beta
- Container: 0.4.1

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

networkIssues and features associated with networking and DNS.nextItems in scope for the next few milestones

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions