I have a script in my .gitlab-ci.yml which is not being executed. Here's the script:

    - apk update
    - apk add --no-cache openssh-client sshpass
    - sshpass -p "${USER_PASS}" ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no user@ip 'cd /home/my-folder && sudo docker-compose up --build -d'

I need to go to that /home/my-folder/ path and then execute docker-compose up --build -d.

But the problem is that it's throwing this error:

ssh: connect to host ip port 22: Operation timed out

And when I go manually to host to check if the docker container is running, its not, which means that it didn't run that command.

  • The error message points to a connectivity issue. Is there a firewall involved (at the host, the client and the network)? – Hermann Apr 4 at 11:28
  • @Hermann no I dont think so, because when I'm, running sshpass scp its copying all filles correctly – TimeFrame Apr 4 at 11:38
  • Then there is a discrepancy between scp's and ssh's behaviour in your CI environment. The message ssh: connect to host ip port 22: Operation timed out clearly originates from sshconnect.c, line 525, indicating the socket connection was not established. – Hermann Apr 4 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.