On my local dev machine I use docker.from_env(version=auto)
(docker-py) to get a docker client without any issues. If I run the same statement inside a gitlab-ci
job which run inside a docker container (or with gitlab-runner exec docker ...
during local debugging) to get a docker client I get a DockerException: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))
. How can I get a docker client with docker-py
inside a gitlab-ci
job which runs inside a docker container?
Asked
Active
Viewed 195 times
0

thinwybk
- 4,193
- 2
- 40
- 76
1 Answers
0
I think you'll need to build and deploy your own runner with the following binding '/var/sock/docker.sock:/var/sock/docker.sock.

dstorey
- 106
- 8
-
It turned out that this was the issue. Thx. – thinwybk Jul 26 '18 at 05:57
-
Did you wind up spinning up your own runner for this ? If so do you mind sharing your config ? – dstorey Jul 26 '18 at 23:50
-
I think that's IP of the company I am working for. But as you said it's just about exposing `/var/sock/docker.sock` to the parent context. – thinwybk Jul 27 '18 at 07:45
-
Hint: For local debugging of gitlab-ci job refer to https://forum.gitlab.com/t/set-default-arguments-for-gitlab-runner-exec-docker/5485 – thinwybk Aug 01 '18 at 12:47