#exec arguments vs shell script

1 messages · Page 1 of 1 (latest)

hasty hemlock
#

Either of these will work:

#
.with_exec(["apk", "update"]).with_exec(["apk", "add", "curl"])

This relies on Dagger to execute two commands, one after the other. If the first one fails, the second won't be executed (same behavior as && in a shell).

#

or:

.with_exec(["sh", "-c", "apk update && apk add curl"])

Here you rely on the shell to execute up to two commands. Dagger only sees one command executed: the shell.

#

Both work fine. Generally the first is better because it has less moving parts, unless you specifically need to run a shell script.