#Piping *dagger.Container into functions

1 messages · Page 1 of 1 (latest)

frail ember
#

Could do with a section in the docs on this, it's a common question that I and others have asked in the past

drowsy ocean
#

So its possible ? I have tried but cant really get it working.

frail ember
#

You can 'save' a container in a variable and use that variable elsewhere within the Dagger session yes

#
#!/usr/bin/env dagger

one=$(container | from alpine)
two=$($one | with-exec "echo,hello")

Something like that should work, I'm not at my desk to check

velvet spoke
#

Yes this works, the approach @frail ember shows works but you can also just do the interpolation directly, saving as a variable is not required

$(container | from alpine) | with-exec "echo,hello" | stdout

drowsy ocean
#

So you could do that with dagger shell ? Like:

dagger -c '$(container | from alpine) | with-exec "echo,hello" | stdout'
bright belfry
bright belfry