Repository navigation
Closed
Description
What is the issue?
I want to use Docker as a service in Dagger. But when binding docker with service binding, the container stop running without executing any command.
I expected at least the container (Elixir container in the example) should execute elixir --version and return the result. Or if there's anything wrong, it may log something that indicate the error.
Log output
From go run .:
#1 resolve image config for docker.io/library/docker:23.0.4-dind-rootless
#1 DONE 2.2s
#2 resolve image config for docker.io/hexpm/elixir:1.14.0-erlang-24.3.4-alpine-3.16.0
#2 DONE 0.7s
From Dagger container (registry.dagger.io/engine:v0.5.0):
time="2023-04-24T02:40:54Z" level=debug msg="session started" spanID=1c305bea8789cca0 traceID=7f366793e8b5dc8ce00251ece0ec17d9
time="2023-04-24T02:40:54Z" level=debug msg="unsupported cache type , defaulting export off" spanID=75f5f9e5452a0361 traceID=08b31aa4bc15a904a73711048d9b9106
time="2023-04-24T02:40:54Z" level=debug msg="cache exporter resolver for dagger returned nil, skipping exporter" spanID=75f5f9e5452a0361 traceID=08b31aa4bc15a904a73711048d9b9106
time="2023-04-24T02:40:56Z" level=debug msg=resolving host=registry-1.docker.io spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006
time="2023-04-24T02:40:56Z" level=debug msg="do request" host=registry-1.docker.io request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=buildkit/v0.0-dev request.method=HEAD spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006 url="https://registry-1.docker.io/v2/library/docker/manifests/23.0.4-dind-rootless"
time="2023-04-24T02:40:56Z" level=debug msg="healthcheck completed" actualDuration="805.208µs" spanID=bd5a4f1c3e10427d timeout=30s traceID=aff580b3237f87444c0460531b52a609
time="2023-04-24T02:40:59Z" level=debug msg="fetch response received" host=registry-1.docker.io response.header.content-length=549 response.header.content-type=application/vnd.docker.distribution.manifest.list.v2+json response.header.date="Mon, 24 Apr 2023 02:40:59 GMT" response.header.docker-content-digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" response.header.docker-distribution-api-version=registry/2.0 response.header.docker-ratelimit-source=97d94f38-74c0-11e4-bea4-0242ac11001b response.header.etag="\"sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a\"" response.header.ratelimit-limit="200;w=21600" response.header.ratelimit-remaining="198;w=21600" response.header.strict-transport-security="max-age=31536000" response.status="200 OK" spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006 url="https://registry-1.docker.io/v2/library/docker/manifests/23.0.4-dind-rootless"
time="2023-04-24T02:40:59Z" level=debug msg=resolved desc.digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" host=registry-1.docker.io spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" mediatype=application/vnd.docker.distribution.manifest.list.v2+json size=549 spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:2538ea1aec9be5b0e93fb9d2088a5e3af5d2ad3d7ab280d0a779fab15a541ad7" mediatype=application/vnd.docker.distribution.manifest.v2+json size=4296 spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:da5f146df7948b500b2001573b8471329eb8044c0595b1aee105b1433961919c" mediatype=application/vnd.docker.container.image.v1+json size=13711 spanID=0db54ab81774c660 traceID=f622981b876d3fe3a174069c9db24006
time="2023-04-24T02:40:59Z" level=debug msg=resolving host=registry-1.docker.io spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430
time="2023-04-24T02:40:59Z" level=debug msg="do request" host=registry-1.docker.io request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=buildkit/v0.0-dev request.method=HEAD spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430 url="https://registry-1.docker.io/v2/library/docker/manifests/23.0.4-dind-rootless"
time="2023-04-24T02:40:59Z" level=debug msg="fetch response received" host=registry-1.docker.io response.header.content-length=549 response.header.content-type=application/vnd.docker.distribution.manifest.list.v2+json response.header.date="Mon, 24 Apr 2023 02:41:00 GMT" response.header.docker-content-digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" response.header.docker-distribution-api-version=registry/2.0 response.header.docker-ratelimit-source=97d94f38-74c0-11e4-bea4-0242ac11001b response.header.etag="\"sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a\"" response.header.ratelimit-limit="200;w=21600" response.header.ratelimit-remaining="198;w=21600" response.header.strict-transport-security="max-age=31536000" response.status="200 OK" spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430 url="https://registry-1.docker.io/v2/library/docker/manifests/23.0.4-dind-rootless"
time="2023-04-24T02:40:59Z" level=debug msg=resolved desc.digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" host=registry-1.docker.io spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:d9ad5130fa11a3dc1abe42bec5cbf255b1ce02bdf710a088a1ce8b617e49870a" mediatype=application/vnd.docker.distribution.manifest.list.v2+json size=549 spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:2538ea1aec9be5b0e93fb9d2088a5e3af5d2ad3d7ab280d0a779fab15a541ad7" mediatype=application/vnd.docker.distribution.manifest.v2+json size=4296 spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430
time="2023-04-24T02:40:59Z" level=debug msg=fetch digest="sha256:da5f146df7948b500b2001573b8471329eb8044c0595b1aee105b1433961919c" mediatype=application/vnd.docker.container.image.v1+json size=13711 spanID=2d43bf3dc310aad8 traceID=3238d7b42125c07be12936e1c8c67430
time="2023-04-24T02:40:59Z" level=debug msg=resolving host=registry-1.docker.io spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3
time="2023-04-24T02:40:59Z" level=debug msg="do request" host=registry-1.docker.io request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=buildkit/v0.0-dev request.method=HEAD spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3 url="https://registry-1.docker.io/v2/hexpm/elixir/manifests/1.14.0-erlang-24.3.4-alpine-3.16.0"
time="2023-04-24T02:40:59Z" level=debug msg="healthcheck completed" actualDuration=3.728458ms spanID=1c305bea8789cca0 timeout=30s traceID=7f366793e8b5dc8ce00251ece0ec17d9
time="2023-04-24T02:41:00Z" level=debug msg="fetch response received" host=registry-1.docker.io response.header.content-length=772 response.header.content-type=application/vnd.docker.distribution.manifest.list.v2+json response.header.date="Mon, 24 Apr 2023 02:41:00 GMT" response.header.docker-content-digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" response.header.docker-distribution-api-version=registry/2.0 response.header.docker-ratelimit-source=97d94f38-74c0-11e4-bea4-0242ac11001b response.header.etag="\"sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab\"" response.header.ratelimit-limit="200;w=21600" response.header.ratelimit-remaining="198;w=21600" response.header.strict-transport-security="max-age=31536000" response.status="200 OK" spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3 url="https://registry-1.docker.io/v2/hexpm/elixir/manifests/1.14.0-erlang-24.3.4-alpine-3.16.0"
time="2023-04-24T02:41:00Z" level=debug msg=resolved desc.digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" host=registry-1.docker.io spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" mediatype=application/vnd.docker.distribution.manifest.list.v2+json size=772 spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:161437f2e1fe49f354abab2a91b4cff7fab1f405550770f4cbc350ce315c603d" mediatype=application/vnd.docker.distribution.manifest.v2+json size=1162 spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:2bb75ba5041cb2f11c0da587f998a98730cd6cc276d1ceb93f965846770bea91" mediatype=application/vnd.docker.container.image.v1+json size=2383 spanID=44f82957783fd7ee traceID=d2b1c05e9a874e9c16d8c3fa8cdcf1e3
time="2023-04-24T02:41:00Z" level=debug msg=resolving host=registry-1.docker.io spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd
time="2023-04-24T02:41:00Z" level=debug msg="do request" host=registry-1.docker.io request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, */*" request.header.user-agent=buildkit/v0.0-dev request.method=HEAD spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd url="https://registry-1.docker.io/v2/hexpm/elixir/manifests/1.14.0-erlang-24.3.4-alpine-3.16.0"
time="2023-04-24T02:41:00Z" level=debug msg="fetch response received" host=registry-1.docker.io response.header.content-length=772 response.header.content-type=application/vnd.docker.distribution.manifest.list.v2+json response.header.date="Mon, 24 Apr 2023 02:41:01 GMT" response.header.docker-content-digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" response.header.docker-distribution-api-version=registry/2.0 response.header.docker-ratelimit-source=97d94f38-74c0-11e4-bea4-0242ac11001b response.header.etag="\"sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab\"" response.header.ratelimit-limit="200;w=21600" response.header.ratelimit-remaining="198;w=21600" response.header.strict-transport-security="max-age=31536000" response.status="200 OK" spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd url="https://registry-1.docker.io/v2/hexpm/elixir/manifests/1.14.0-erlang-24.3.4-alpine-3.16.0"
time="2023-04-24T02:41:00Z" level=debug msg=resolved desc.digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" host=registry-1.docker.io spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:bfcd284f327e98adf231cad592f9629fc7adf78d7f1a5511cd451085a528eeab" mediatype=application/vnd.docker.distribution.manifest.list.v2+json size=772 spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:161437f2e1fe49f354abab2a91b4cff7fab1f405550770f4cbc350ce315c603d" mediatype=application/vnd.docker.distribution.manifest.v2+json size=1162 spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd
time="2023-04-24T02:41:00Z" level=debug msg=fetch digest="sha256:2bb75ba5041cb2f11c0da587f998a98730cd6cc276d1ceb93f965846770bea91" mediatype=application/vnd.docker.container.image.v1+json size=2383 spanID=50a0ba61b4381a15 traceID=f5622e8770e9332a9506075e6fd48dcd
time="2023-04-24T02:41:00Z" level=debug msg="session finished: <nil>" spanID=1c305bea8789cca0 traceID=7f366793e8b5dc8ce00251ece0ec17d9
time="2023-04-24T02:41:01Z" level=debug msg="healthcheck completed" actualDuration=1.358334ms spanID=bd5a4f1c3e10427d timeout=30s traceID=aff580b3237f87444c0460531b52a609
Steps to reproduce
Create new directory, run go mod init and create go source with content below:
package main
import (
"context"
"os"
"dagger.io/dagger"
)
func main() {
ctx := context.Background()
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
panic(err)
}
defer client.Close()
dockerCertsCA := client.CacheVolume("docker-certs-ca")
dockerCertsClient := client.CacheVolume("docker-certs-client")
dockerDind := client.Container().
From("docker:23.0.4-dind-rootless").
WithMountedCache("/certs/ca", dockerCertsCA).
WithMountedCache("/certs/client", dockerCertsClient).
WithEnvVariable("DOCKER_TLS_CERTDIR", "/certs")
client.Container().
From("hexpm/elixir:1.14.0-erlang-24.3.4-alpine-3.16.0").
WithServiceBinding("docker-dind", dockerDind).
WithMountedCache("/certs/client", dockerCertsClient).
WithExec([]string{"elixir", "--version"}).
Stdout(ctx)
}And then run go run ..
SDK version
Go SDK 0.6.0
OS version
macOS 13.1 (22C65)
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]🐞 <title>[/-][+]🐞 Dagger stop running when use docker dind as a service binding[/+]wingyplus commentedon Apr 24, 2023
Tested against Dagger v0.5.0:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 37578df53394 registry.dagger.io/engine:v0.5.0 "dagger-entrypoint.s…" 43 seconds ago Up 42 seconds dagger-engine-23e74c13b0f5a5d1helderco commentedon Apr 24, 2023
Hi @wingyplus, you need to add
WithExec(nil)todockerDindbecause it has no exec instruction. Thenilwill execute default entrypoint and arguments in the image.I'm currently working on giving a better overview and explanation of this in:
And I'm planning on publishing a fix today that won't require that
WithExec(nil)anymore:You can also try the TUI to get clarity on what's running:
Let me know if adding
WithExec(nil)doesn't fix it.wingyplus commentedon Apr 24, 2023
@helderco Thank you. It seems to work now after add
WithExec(nil)and changing image todind:May I have a new question about
CANCELEDat layer#5, it got canceled because the main container getting stop?helderco commentedon Apr 24, 2023
Explanation for why the
WithExec(nil)at:As for the
CANCELED, @vito has more context.vito commentedon Apr 24, 2023
Services get interrupted when they're no longer used, which currently shows up as
CANCELEDin the UI. It's slightly confusing but technically correct. 😅We'll probably improve this in the future by making the UIs more "service aware" - right now it's basically just exposing Buildkit's perspective on what's going on.
wingyplus commentedon Apr 24, 2023
@helderco @vito Thank you, you two. I understand now what's going on here. ^^