Has anyone had any luck running the build and regi...
# prefect-server
m
Has anyone had any luck running the build and register step for their flows in a gitlab CI runner? I'm having trouble with the docker storage being unable to find the docker API when running in gitlab
c
Hi Matt, when building / registering from CircleCI, the following Docker config was useful for me:
Copy code
import docker

default_client = docker.from_env()

storage = Docker(
        base_url=default_client.api.base_url,
        tls_config=docker.TLSConfig(default_client.api.cert),
        ...,
)
m
I'll give that a shot, thanks
๐Ÿ‘ 1
Did you need any extra options in your gitlabci.yaml file as well?
c
This was in GitHub actually
m
Ah gotcha
c
but no additional config necessary in GitHub or Circle FWIW
๐Ÿ‘ 1
m
Do you know if there's a way to pass in private registry credentials to the Docker storage object?
c
You canโ€™t pass them in via the Python API, but the
docker
client itself uses whatever auth your local docker daemon has; so as long as you authenticate from the docker CLI you should be good
m
Ah, I see. Thanks
๐Ÿ‘ 1
a
@Matt Allen @Chris White do you have any more insight into this. Trying to do docker in docker to register a flow on gitlab ci and even with these changes still getting issues
Copy code
File "/usr/local/lib/python3.8/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
m
Do you have this variable in your gitlabci file?
DOCKER_HOST: <tcp://docker:2376>
Along with
Copy code
services:
  - docker:19.03.12-dind
a
i have the dind but not that var. Ill try it thanks
new issue, this is my first docker in docker so I appreciate the help
Copy code
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnectionPool(host='docker', port=2376): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc4c4bafee0>: Failed to establish a new connection: [Errno 111] Connection refused'))
m
Are you running docker login before you run your register flow script?
I actually switched away from using the docker storage because of speed issues, so I'm trying to remember my debugging steps
a
right so im not using docker storage. I am using GCP container registry
its probably that i just need to gcloud auth first isnt it? a connection refused error is so opaque
m
Ah yeah that could be it. If you're not using docker storage I don't think you'd need docker in docker at all actually
a
yeah everything is authenticated still getting the same error. Certainly you need docker in docker right? because i am in a docker container (gitlab ci) building the docker storage for a flow to register and send off to gcr.
m
Oh I was confused when you said you weren't using docker storage, nevermind
The error you are getting still looks like it can't connect to the docker daemon, which happens before it tries to authenticate with gcp container registry