Skip to content

"RUN --mount=type=ssh" only accessible to root #760

@rmoriz

Description

@rmoriz

(as reported in docker/cli#1419 (comment))

The ssh socket is owned and accessibly by root only, e.g.

# syntax=docker/dockerfile:1.0.0-experimental
FROM alpine
RUN apk add --no-cache openssh-client \
   && adduser -h /example -S example example

# we are now switching to our new user and trying to access the SSH_AUTH_SOCK to list all available identities
USER example
RUN --mount=type=ssh ssh-add -l
#8 [3/3] RUN --mount=type=ssh ssh-add -l
#8       digest: sha256:b08486fd10670778bf8ca6bdc0f5950c74035d5c7f458ad24c381b7652ce1dd2
#8         name: "[3/3] RUN --mount=type=ssh ssh-add -l"
#8      started: 2018-12-21 17:24:51.397207862 +0000 UTC
#8 2.410 Error connecting to agent: Permission denied
#8    completed: 2018-12-21 17:24:54.266487196 +0000 UTC
#8     duration: 2.869279334s
#8        error: "executor failed running [/bin/sh -c ssh-add -l]: exit code: 2"

(Docker version 18.09.0, build 4d60db4)

IMHO there should be an option either to specify the uid/gid of the socket or the file mode. If this cannot be achived due to other issues, please add a note to the documentation and clarify that only root users can access the socket until further notice. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions