#retrieve env variables from container

1 messages · Page 1 of 1 (latest)

sleek basin
#

From what I understood, envvariables retrieves all the env variables from a container:

package main

import (
    "context"
    "fmt"

    "dagger.io/dagger"
)

func main() {
    ctx := context.Background()
    client, err := dagger.Connect(ctx)
    if err != nil {
        panic(err)
    }
    defer client.Close()


    daggerImg, err := client.Container().From("alpine:3.16.2").EnvVariables(ctx)
    if err != nil {
        panic(err)
    }

    fmt.Println(daggerImg)

}

Given this go file, it doesn't work, I get this error:

panic: input:1: Field "envVariables" of type "[EnvVariable!]!" must have a sub selection.

Please visit https://dagger.io/help#go for troubleshooting guidance.
uneven fossil