I am trying to connect to a docker daemon running on a VM using DOCKER_HOST="ssh://user@IPAddress".
I have configured the machine using with correct ssh keys.
From the gitlab-runner VM I can manually login to the remote machine using ssh user@IPAddress. I accessing it under the gitlab-runner user account. gitlab-runner account is in the docker group. It is a non login account. Not added to the sudo group either.
When I try to accesss docker daemon from a gitlab CI job with Shell executor.
Job:
- echo "$(whoami)"
- eval $(ssh-agent -s)
- ssh-add ~/.ssh/id_rsa_devops
- export DOCKER_HOST="ssh://user@IPAddress"
- docker info
Output
gitlab-runner
Agent pid 7418
/home/gitlab-runner/.ssh/id_rsa_devops: No such file or directory
I checked the key, and it is there on that path. I am not sure what is going wrong can someone tell me please ?
stat ~/.ssh/id_rsa_devops?