Skip to content

Instantly share code, notes, and snippets.

@shan100github
Last active June 28, 2023 05:48
Show Gist options
  • Save shan100github/73ffe549b750094ea0bb88f5c6c2b750 to your computer and use it in GitHub Desktop.
Save shan100github/73ffe549b750094ea0bb88f5c6c2b750 to your computer and use it in GitHub Desktop.
Push images from local to remote harbor registry through AWS SSM

Overview:

Due to limitations in the harbor registry, we cannot port forward to connect the harbor registry for local system. However, we can save the image and send it to jump server/remote server, and through the remote server we can upload the image to the harbor private registry.

ssh config:

Added below in ~/.ssh/config

  Host base
    User <user>
    IdentityFile ~/.ssh/<private key>
    HostName ip/hostid/hostname
    ProxyCommand sh -c "aws ssm start-session --target  %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p' --profile <aws profile>"

  Host doc-jump
    User <user>
    IdentityFile ~/.ssh/<private key>
    HostName ip/hostid/hostname
    ProxyCommand ssh -q -CW %h:%p base

Sample commands

docker tag cirros:latest <harbor externalurl>/test/cirros:latest
ssh  doc-jump "docker load --input ~/doc-image/cirros.tar"
ssh  doc-jump "docker images"
ssh  doc-jump "docker push <harbor externalurl>/test/cirros:latest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment