mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-28 16:37:43 +08:00
docs: add info for on-error and debug-shell values for invoke
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
af3feec4ea
commit
4ce80856b3
@ -49,6 +49,47 @@ bin etc lib mnt proc run srv tmp var
|
||||
dev home media opt root sbin sys usr work
|
||||
```
|
||||
|
||||
#### `on-error`
|
||||
|
||||
If you want to start a debug session when a build fails, you can use
|
||||
`--invoke=on-error` to start a debug session when the build fails.
|
||||
|
||||
```console
|
||||
$ docker buildx build --invoke on-error .
|
||||
[+] Building 4.2s (19/19) FINISHED
|
||||
=> [internal] connecting to local controller 0.0s
|
||||
=> [internal] load build definition from Dockerfile 0.0s
|
||||
=> => transferring dockerfile: 32B 0.0s
|
||||
=> [internal] load .dockerignore 0.0s
|
||||
=> => transferring context: 34B 0.0s
|
||||
...
|
||||
=> ERROR [shell 10/10] RUN bad-command
|
||||
------
|
||||
> [shell 10/10] RUN bad-command:
|
||||
#0 0.049 /bin/sh: bad-command: not found
|
||||
------
|
||||
Launching interactive container. Press Ctrl-a-c to switch to monitor console
|
||||
Interactive container was restarted with process "edmzor60nrag7rh1mbi4o9lm8". Press Ctrl-a-c to switch to the new container
|
||||
/ #
|
||||
```
|
||||
|
||||
This allows you to explore the state of the image when the build failed.
|
||||
|
||||
#### `debug-shell`
|
||||
|
||||
If you want to drop into a debug session without first starting the build, you
|
||||
can use `--invoke=debug-shell` to start a debug session.
|
||||
|
||||
```
|
||||
$ docker buildx build --invoke debug-shell .
|
||||
[+] Building 4.2s (19/19) FINISHED
|
||||
=> [internal] connecting to local controller 0.0s
|
||||
(buildx)
|
||||
```
|
||||
|
||||
You can then use the commands available in [monitor mode](#monitor-mode) to
|
||||
start and observe the build.
|
||||
|
||||
## Monitor mode
|
||||
|
||||
By default, when debugging, you'll be dropped into a shell in the final stage.
|
||||
|
Loading…
x
Reference in New Issue
Block a user