GitLab: Error connecting to local docker daemon

Hello,

I’m trying to deploy to fly as part of a GitLab workflow. This worked for months until now, probably something changed in GitLab, but no idea what it could be.

...
$ docker images
REPOSITORY                TAG       IMAGE ID       CREATED              SIZE
kikobeats/my-service   next      202cfe7e3e0f   About a minute ago   4.23GB
kikobeats/my-service   <none>    ff167cfd3b12   8 minutes ago        4.23GB
$ fly doctor
Testing authentication token... PASSED
Testing flyctl agent... FAILED
(Error: couldn't ping agent: agent not running)
Can't communicate with flyctl's background agent.
Run 'flyctl agent restart'.
$ fly agent restart
$ cat $(ls -1d ~/.fly/agent-logs/* | head -n 1)
2024/02/15 13:01:13.143018 srv OK 213
2024/02/15 13:01:13.143031 srv monitoring for token expiration
2024/02/15 13:01:13.191667 #1 connected ...
2024/02/15 13:01:13.191711 #1 <- (    4) "ping"
2024/02/15 13:01:13.191798 #1 -> (   53) "3\x00ok {\"PID\":213,\"Version\":\"0.2.4\",\"Background\":true}\n"
2024/02/15 13:01:13.191819 #1 dropped.
$ fly scale count 1 --vm-cpus 2 --vm-cpu-kind shared --vm-memory=1024 --yes --app microlink-next
App already scaled to desired state. No need for changes
$ fly deploy -e NODE_ENV=staging --image=kikobeats/my-service:next --image-label=next --local-only --update-only --app microlink-next
==> Verifying app config
--> Verified app config
Validating /builds/microlink/api/fly.toml
✓ Configuration is valid
==> Building image
WARN Error connecting to local docker daemon:cannot apply host to transport: *otelhttp.Transport
WARN failed to create build in graphql: input:3: createBuild Could not find App
Error: failed to fetch an image or build from source: no docker daemon available
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1

Any idea about what’s happening here? :frowning:

The same error was reported in Cannot deploy since flyctl v0.1.149: cannot apply host to transport: *otelhttp.Transport · Issue #3274 · superfly/flyctl · GitHub. Let me take a look.

Hey folks,

removing the DOCKER_HOST environment variable and replacing it with BUILDKIT_HOST might get you a bit further along.

I think this may be related to a recent flyctl bump of the underlying buildkit library, that’s where this error is coming from.

Concretely, it’s likely you have:

DOCKER_HOST: tcp://docker:2375/

try unsetting that and adding instead

BUILDKIT_HOST: tcp://docker:2375/

note you probably need to explicitly unset DOCKER_HOST as it’s rather persistently set by gitlab configuration somewhere.

That said, it certainly could be an upstream buildkit regression, so the above procedure is to be considered a workaround.

Thanks for the reply. I tried your suggestion but it didn’t work it, still failing to me even I don’t have DOCKER_HOST and I set BUILDKIT_HOST as you suggested.

In the context of my issue I don’t know how GitLab is using buildkit. I’m using “docker:dind”, do you think that could be related? :thinking:

@roadmr How did you know that! Now I can reproduce the issue. Fixing as Fix `cannot apply host to transport: *otelhttp.Transport` by kzys · Pull Request #3298 · superfly/flyctl · GitHub.

@Kikobeats Sorry for the breakage. I’m going to fix and release flyctl in few hours.

1 Like

We’ve just released 0.2.7 which should fix the issue. Let me know if that works!

I can confirm it works now!

Confirmed it’s fixed :slightly_smiling_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.