#Use Dagger SDKs in CI | Dagger
1 messages ยท Page 1 of 1 (latest)
@rustic mango (started a proper thread)
Here is my current job
.docker:
image: node:20-alpine
services:
- docker:${DOCKER_VERSION}-dind
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_VERIFY: '1'
DOCKER_TLS_CERTDIR: '/certs'
DOCKER_CERT_PATH: '/certs/client'
DOCKER_DRIVER: overlay2
DOCKER_VERSION: '20.10.16'
.dagger:
extends: [.docker]
before_script:
- apk add docker-cli curl
- cd /usr/local && { curl -L https://dl.dagger.io/dagger/install.sh | sh; cd -; }
dagger-build:
extends: [.dagger]
stage: build
script:
- docker info
- which -a docker
# - npm install -g @dagger.io/dagger
- cd dagger
- npm install
- DOCKER_HOST=tcp://docker:2376 docker run hello-world
# - DOCKER_HOST=tcp://docker:2376 node test.mjs
- DOCKER_HOST=tcp://docker:2376 dagger run node dagger/test.mjs
Well.. the only difference I see with my example and your code is that I don't use the stage attribute in my build job. Not sure if that changes anything though ๐ค
I copied the code that was in the example.
If I remove the DOCKER_HOST variable, then the docker info calls fails
That should just control when the job runs
... does dagger use the DOCKER_HOST to figure out how to connect to docker ?
Yes, if that variable is present, it should use that
ya... thats what I figured... but then I get
$ DOCKER_HOST=tcp://docker:2376 dagger run node dagger/test.mjs
new client: failed to run container: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
: exit status 125
Are you using gitlab self hosted or something that could be different?
Strange that it works for my public repo in shared runners also
no... we are using a hosted private repo
Very strange.. I'm AFK now. I'd try copying the gitlab.ci I've shared about as-is just to make sure that at least you can connect to the docker daemon
Cool... I'll try that... Thanks for your help
I just copied the main.py and the .gitlab-ci.yml and I'm getting the same issue with dagger trying to use the unix socket.
I'm going to try to add this job to one of my other repos and see how that behaves
I just tried it on another repo and it worked fine... so I don't know what is going on with that repo
so it looks like the difference is that on the repo that doesn't work, it has the DAGGER_CLOUD_TOKEN variable defined
If I removed that from my 'normal' repo, then it successfully connects to docker
hey! just seeing this. That doesn't make any sense, haha ๐
do you have that variable set to a valid token?
Just saw this now... the token is valid, and I have the same one locally and it works.
I just added the token again, and it fails with the same error, but when I removed it, it worked
I'll try adding a DAGGER_CLOUD_TOKEN to my gitlab repo example and see if I can repro ๐