Unable to find image 'bitbucketpipelines/ssh-run:0.4.0' locally
Asked by capsicumdreams:

Hi all,

I'm new to pipelines, so probably am doing very obviously wrong.  
I'm starting out simple, and basically copying the templates provided.  

```
image: node:16

pipelines:

  branches:

    master:

      - step:

          name: Test

          script:

            - cd Server/Source

            - npm install

            - npm test

      - step:

          name: Pre-Deploy

          script:

            - pipe: atlassian/ssh-run:0.4.0

              variables:

                SSH_USER: 'root'

                SERVER: '31.220.31.93'

                SSH_KEY: $ssh_key

                MODE: 'command'

                COMMAND: '/root/dir/pre-deploy.sh' # path to a script in your repository
```

```
?
```

The \`test\` step executes without a problem.  
However, I can't run the ssh command

Help, please? :)
> + docker container run \  
> --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \  
> --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \  
> --volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \  
> --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \  
> --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run \  
> --workdir=$(pwd) \  
> --label=org.bitbucket.pipelines.system=true \  
> --env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \  
> --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \  
> --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \  
> --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \  
> --env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \  
> --env=CI="$CI" \  
> --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \  
> --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \  
> --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \  
> --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \  
> --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \  
> --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \  
> --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \  
> --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \  
> --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \  
> --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \  
> --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \  
> --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \  
> --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \  
> --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \  
> --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \  
> --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \  
> --env=DOCKER_HOST="tcp://host.docker.internal:2375" \  
> --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \  
> --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run" \  
> --env=COMMAND="/root/squawker/pre-deploy.sh" \  
> --env=MODE="command" \  
> --env=SERVER="31.220.31.93" \  
> --env=SSH_KEY="$ssh_key" \  
> --env=SSH_USER="root" \  
> --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \  
> bitbucketpipelines/ssh-run:0.4.0  
> Unable to find image 'bitbucketpipelines/ssh-run:0.4.0' locally

```
?
```


Answers:
author: capsicumdreams
body: [@Syahrul](/t5/user/viewprofilepage/user-id/744536)was right - I changed how I supplied the SSH key., and it runs fine, now.  
I'd prefer there was a nicer error message, but it's all functional.  

Thanks ?


author: capsicumdreams
body: ![](https://i.postimg.cc/y6krJgFy/image.png)

there is no html!!


author: Syahrul
body: Hi [@capsicumdreams](/t5/user/viewprofilepage/user-id/3134223)

Apologize for the confusion, the error you mention "Unable to find image 'bitbucketpipelines/ssh-run:0.4.0' locally" is a completely fine error as the pipe is not stored locally so it won't be able to find it hence the error.  
The build will then proceed to download the image from Docker afterward so you can safely ignore the error.

Now as for why the pipe did not trigger the SSH commands, I would suggest you enable the debug mode in the pipe to get more information. Below are an example of enabling the debug mode:

```
script:  - pipe: atlassian/ssh-run:0.4.0    variables:      SSH_USER: 'ec2-user'      SERVER: '127.0.0.1'      COMMAND: 'echo $HOSTNAME'      DEBUG: true
```

Once you get the output, feel free to share it here if you can't find out why it's failing, but do filter out any sensitive information first before sharing.

Cheers,  
Syahrul

comments: author: capsicumdreams
body: Thanks, Syahrul,

I've spent 45 minutes trying to type out a reply - but it complains that I'm sending the same message too often.  
"Update your text, or wait before reposting."

I have done both. For over half an hour, so far.

Infuriating.

Here is a Onedrive link to a reply that isn't blocked by your overly-ambitious spam system.

<https://1drv.ms/t/s!AkuYD2UOMAw_iqwzZBtMfET6kmdJAQ?e=Yy0qHE>

Thanks a lot for trying to help..


author: Syahrul
body: Hey [@capsicumdreams](/t5/user/viewprofilepage/user-id/3134223) ,

G'Day!

Sorry to hear you are having an issue with the community text post, most likely an issue with too many logs to share.

I try opening the link but it's empty for me without any logs/data could you check and confirm that or share using another alternate method such as google drive etc?

Thanks,  
Syahrul


author: capsicumdreams
body: Having **serious** difficulty even responding using this editor.  
Do you guys need some software engineers?


author: capsicumdreams
body: ![image](https://community.atlassian.com/t5/image/serverpage/image-id/186868i9F124E6274E128E3/image-size/large?v=v2&px=999 "image")


author: capsicumdreams
body: It seems only Microsoft Edge is supported? ?????

Thanks for getting back to me..

Still unable to execute ssh-run with a meaningful pass/failure..

<br />

Unable to find image 'bitbucketpipelines/ssh-run:0.4.0' locally  
0.4.0: Pulling from bitbucketpipelines/ssh-run  
31603596830f: Pulling fs layer  
c507f8e37a23: Pulling fs layer  
7eca4d8c4c7b: Pulling fs layer  
c21a713484c2: Pulling fs layer  
c21a713484c2: Waiting  
7eca4d8c4c7b: Verifying Checksum  
7eca4d8c4c7b: Download complete  
31603596830f: Verifying Checksum  
31603596830f: Download complete  
c507f8e37a23: Verifying Checksum  
c507f8e37a23: Download complete  
31603596830f: Pull complete  
c21a713484c2: Download complete  
c507f8e37a23: Pull complete  
7eca4d8c4c7b: Pull complete  
c21a713484c2: Pull complete  
Digest: sha256:2aa2f6517fb364da07a18f8b1e55b651c1db0361f7a850b79914c8da663f709e  
Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.4.0  
INFO: Executing the pipe...  
INFO: Using passed SSH_KEY  
base64: truncated base64 input

Is \`base64: truncated base64 input\` interesting?


author: Syahrul
body: Hi [@capsicumdreams](/t5/user/viewprofilepage/user-id/3134223)

Looking at the error log "base64: truncated base64 input" and your YAML setup, I believe the reason why it returns the error is because the SSH key you saved in your variables is truncated hence it's rejecting the key.

Instead of applying your own SSH key, you can follow these steps:

1. navigate to the repository setting
2. Under pipelines click SSH keys and generate new keys.
3. Copy the public keys and save them on your server at **\~/.ssh/authorized_keys**
4. Once done, update your YAML as follows:

```
      - step:          name: Pre-Deploy          script:            - pipe: atlassian/ssh-run:0.4.0              variables:                SSH_USER: 'root'                SERVER: 'IP'                MODE: 'command'                COMMAND: '/root/dir/pre-deploy.sh' 
```

I hope this helps, more information on using SSH key with the pipeline, please checks our documentation at

* [Use SSH keys in Bitbucket pipelines](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Use-SSH-keys-in-Bitbucket-Pipelines)

Cheers,  
Syahrul


author: capsicumdreams
body: Great, thanks - I'd prefer to look at the key I supply rather than add a key to the server.  
I'll try that... ?


Tags: bitbucket-cloud

cloud

ssh