docs icon indicating copy to clipboard operation
docs copied to clipboard

mout type=ssh example fails (using DockerDesktop?)

Open SvenDowideit opened this issue 2 years ago • 1 comments
trafficstars

Is this a docs issue?

  • [X] My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

copying the example ssh Dockerfile, and then running the buildx command in the ssh example fails:

Identity added: /Users/dowideit.sven/.ssh/id_rsa (dowideit.sven@ABC-C02XFC5XJG5J)
dowideit.sven@ABC-KC00PW16GC dockerfile % docker buildx build --ssh default=$SSH_AUTH_SOCK .
[+] Building 11.3s (7/8)                                                                                                                       docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                0.0s
 => [internal] load build definition from Dockerfile                                                                                                           0.0s
 => => transferring dockerfile: 270B                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                               3.6s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                  0.0s
 => [stage-0 1/4] FROM docker.io/library/alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978                                        0.8s
 => => resolve docker.io/library/alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978                                                0.0s
 => => sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 1.64kB / 1.64kB                                                                 0.0s
 => => sha256:6ce9a9a256a3495ae60ab0059ed1c7aee5ee89450477f2223f6ea7f6296df555 528B / 528B                                                                     0.0s
 => => sha256:3cc20332140056b331ad58185ab589c085f4e7d79d8c9769533d6a9b95d4b1b0 1.49kB / 1.49kB                                                                 0.0s
 => => sha256:579b34f0a95bb83b3acd6b3249ddc52c3d80f5c84b13c944e9e324feb86dd329 3.33MB / 3.33MB                                                                 0.6s
 => => extracting sha256:579b34f0a95bb83b3acd6b3249ddc52c3d80f5c84b13c944e9e324feb86dd329                                                                      0.1s
 => [stage-0 2/4] RUN apk add --no-cache openssh-client                                                                                                        1.6s
 => ERROR [stage-0 3/4] RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts                                                            5.2s 
------                                                                                                                                                              
 > [stage-0 3/4] RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts:                                                                       
------                                                                                                                                                              
Dockerfile:3                                                                                                                                                        
--------------------                                                                                                                                                
   1 |     FROM alpine
   2 |     RUN apk add --no-cache openssh-client
   3 | >>> RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
   4 |     RUN --mount=type=ssh \
   5 |       ssh -q -T [email protected] 2>&1 | tee /hello
--------------------
ERROR: failed to solve: process "/bin/sh -c mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts" did not complete successfully: exit code: 1

Location

https://docs.docker.com/engine/reference/builder/#run---mounttypessh

Suggestion

add automation to test examples :)

ssh-keyscan gitlab.com also doesn't output anything, and then returns 1

/ # ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
/ # echo $?
1
/ # ssh-keyscan gitlab.com > ~/.ssh/known_hosts
/ # echo $?
1

SvenDowideit avatar Oct 18 '23 00:10 SvenDowideit

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Mar 15 '24 01:03 docker-robot[bot]

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

docker-robot[bot] avatar Apr 28 '24 03:04 docker-robot[bot]