SSH into staging machine from docker instance using Bitbucket Pipelines

前端 未结 2 460
闹比i
闹比i 2021-02-06 06:20

Using the new Bitbucket Pipelines feature, how can I SSH into my staging box from the docker container it spins up?

The last step in my pipeline is an .sh

2条回答
  •  萌比男神i
    2021-02-06 07:04

    You can now setup SSH keys under pipeline settings so that you do not need to have a private docker image just to store ssh keys. It is also extracted from your source code so you don't have it in your repo as well.

    Under

    Settings -> Pipelines -> SSH keys
    

    You can either provide a key pair or generate a new one. The private key will be put in the docker container at ~/.ssh/config and provide you a public key you can put in your host to the ~/.ssh/authorized_keys file. The page also requires an ip or name to setup the fingerprint for known hosts when running on docker as well.

    Also, Bitbucket has provided IP addresses you can white list if necessary for the docker containers being spun up. They are currently:

    • 34.236.25.177/32
    • 34.232.25.90/32
    • 52.203.14.55/32
    • 52.202.195.162/32
    • 52.204.96.37/32
    • 52.54.90.98/32
    • 34.199.54.113/32
    • 34.232.119.183/32
    • 35.171.175.212/32

提交回复
热议问题