i’ve been trying to use ssh to connect into my docker container which i use as a web server.
but when running ssh connect in gitlab CI, i am getting a time out
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *debug1: Connecting to x.x.x.x [x.x.x.x] port 5000.
debug1: connect to address x.x.x.x port 5000: Connection timed out
ssh: connect to host x.x.x.x port 5000: Connection timed out
my .gitlab.yml :
image: ubuntu:latest
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
deploy_stage:
stage: deploy
environment: Staging
only:
- master
script:
- ssh -v -p 5000 toto@x.x.x.x "ls"
i am able to connect with any other shell, but not when using gitlab CI.
any idea on how to fix it ?