#Dagger Buildkit Layer Export Not Working

1 messages · Page 1 of 1 (latest)

ripe sky
#

I am using dagger v0.13.7. And all the execution is happening from my local. I am using mac and docker.

package main

import (
    "context"
    "dagger/dagger-layer-exporter/internal/dagger"
)

type DaggerLayerExporter struct{}

// Returns a container that echoes whatever string argument is provided
func (m *DaggerLayerExporter) ContainerEcho(stringArg string) *dagger.Container {
    return dag.Container().From("alpine:latest").WithExec([]string{"echo", stringArg})
}

// Returns lines that match a pattern in the files of the provided Directory
func (m *DaggerLayerExporter) GrepDir(ctx context.Context, directoryArg *dagger.Directory, pattern string) (string, error) {
    return dag.Container().
        From("alpine:latest").
        WithMountedDirectory("/mnt", directoryArg).
        WithWorkdir("/mnt").
        WithExec([]string{"grep", "-R", pattern, "."}).
        Stdout(ctx)
}

Command I am running

_EXPERIMENTAL_DAGGER_CACHE_CONFIG="type=registry,ref=registry:5000/test-cache11,mode=max" dagger call grep-dir --directory-arg . --pattern dagger -vvv

I also, have registry running

docker run  -p 5000:5000 --restart always --name registry registry:2

I am expecting the layer cache to be exported in the local running registry. But that's not happening. The dagger call command runs successfully but nothing gets pushed to registry

What i looking for is, layer cache get exported to this registry and in subsequent run use this registry for getting the cache.