I tried to create a Dockerfile for my project. I also installed an external git repository using ssh. When building the project, this error occurred.
> [builder 6/8] RUN --mount=type=ssh npm ci:
#13 81.97 npm notice
#13 81.97 npm notice New minor version of npm available! 8.11.0 -> 8.15.0
#13 81.97 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.15.0>
#13 81.97 npm notice Run `npm install -g npm@8.15.0` to update!
#13 81.97 npm notice
#13 81.97 npm ERR! code 128
#13 81.98 npm ERR! An unknown git error occurred
#13 81.98 npm ERR! command git --no-replace-objects ls-remote ssh://git@bitbucket.org/houseofdevtech/verscan-protobuf.git
#13 81.98 npm ERR! Warning: Permanently added 'bitbucket.org' (RSA) to the list of known hosts.
#13 81.98 npm ERR! git@bitbucket.org: Permission denied (publickey).
#13 81.98 npm ERR! fatal: Could not read from remote repository.
#13 81.98 npm ERR!
#13 81.98 npm ERR! Please make sure you have the correct access rights
#13 81.98 npm ERR! and the repository exists.
#13 81.99
#13 81.99 npm ERR! A complete log of this run can be found in:
#13 81.99 npm ERR! /home/node/.npm/_logs/2022-07-22T10_18_37_431Z-debug-0.log
------
executor failed running [/bin/sh -c npm ci]: exit code: 128
What should I do?
The problem occurred because I use another user which isn't the root user in the Dockerfile, and that screwed up the ssh thing.
To solve this problem, add uid=<user id of the user> to the --mount=type=ssh command
RUN --mount=type=ssh,uid=<user id> npm ci
Hi there I am trying to run Docker container and continually the container showing its restarting and running and then breaks and the restart. Can any one help me here please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Siriwudhi Sawaidee ,
Welcome to Atlassian Community!
The error message printed in the logs indicates the SSH key you are using to authenticate the git clone command does not have permissions to clone the repository :
#13 81.98 npm ERR! git@bitbucket.org: Permission denied (publickey).
In this case, could you please confirm :
COPY <path to local ssh key>/my_key ~/.ssh/id_rsa
If after following the suggestions above you are still facing the same error, please share the Dockerfile with us so we can help you investigate further.
Thank you, @Siriwudhi Sawaidee .
Kind regards,
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.