10 ms·
OMG https://docs.dagger.io/features/debugging https://docs.dagger.io/features/debugging - Docker hasn't supported shelling into a broken build for a while now,
by a_t48 2y ago
OMG https://docs.dagger.io/features/debugging https://docs.dagger.io/features/debugging - Docker hasn't supported shelling into a broken build for a while now, this sounds so nice. I see there's some Dockerfile support, I wonder if I can just use this as a drop in replacement for `docker build` and get a nicer experience.
- shykes 2y agoYes you can. Dagger is built on the same underlying tech as docker build (buildkit). So the compatibility bridge is not a re-implementation of Dockerfile, it's literally the official upstream implementation. Here's an example that 1) fetches a random git repo 2) builds from its dockerfile 3) opens an interactive terminal to look inside 4) publish to a registry once you exit the terminal: git https://github.com/goreleaser/goreleaser | head | tree | docker-build | terminal | publish ttl.sh/goreleaser-example-image
- a_t48 2y agoIf that docker-build command fails, will the interactive debugger do something sensible?
- shykes 2y agoAssuming you use `dagger --interactive`, the debugger will kick in so you can inspect the failed state. In the specific case of Dockerfile compatibility, I don't actually know if it will be smart enough to drop you in the exact intermediary state that the Docker build failed in, or if it reverts atomically the whole 'docker build' operation.
- philsnow 2y ago> 3) opens an interactive terminal to look inside 4) publish to a registry once you exit the terminal It seems like it would be good to be able to prevent the pipeline from publishing the image, if the inspection with 'terminal' shows there's something wrong (with e.g. 'exit 1'). I looked a little bit into the help system, and it doesn't seem that there's a way from inside the 'terminal' function to signal that the pipeline should stop. Semantics like bash's "set -e -o pipefail" might help here. with-exec lets you specify that you want a command to succeed with e.g. container | from alpine | with-exec --expect SUCCESS /bin/false | publish ... If you try that, the pipeline will stop before publishing the image.
- shykes 2y agoHuh, you're right, I would expect `exit 1` in the terminal to abort the rest of the pipeline. By the way, in your example: `--expect SUCCESS` is the default behavior of with-exec, so you can simplify your pipeline to: container | from alpine | with-exec /bin/false | publish ... Thank you! Would you be willing to open an issue on our github repo? If not I will take care of it.
- levlaz 2y agoYou sure can :) Dagger can read dockefiles as is, https://docs.dagger.io/cookbook#build-image-from-dockerfile https://docs.dagger.io/cookbook#build-image-from-dockerfile
- verdverm 2y agoBeing able to drop into failed container builds / runs has been game changing, saved me mucho time. If you are being programmatic, you can also inject the drop into interactive mode anywhere you want, without needing an error. You can use this to build up working environments into which you drop developers (kind of like dev containers)