mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-30 09:25:45 +08:00
Merge pull request #1817 from jedevc/docs-monitor-invoke-parts
This commit is contained in:
commit
4429ccbcc2
@ -24,7 +24,7 @@ build command to specify a command to launch in the resulting image.
|
|||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker buildx build --invoke /bin/sh .
|
$ docker buildx build --invoke /bin/sh .
|
||||||
+] Building 4.2s (19/19) FINISHED
|
[+] Building 4.2s (19/19) FINISHED
|
||||||
=> [internal] connecting to local controller 0.0s
|
=> [internal] connecting to local controller 0.0s
|
||||||
=> [internal] load build definition from Dockerfile 0.0s
|
=> [internal] load build definition from Dockerfile 0.0s
|
||||||
=> => transferring dockerfile: 32B 0.0s
|
=> => transferring dockerfile: 32B 0.0s
|
||||||
@ -49,6 +49,47 @@ bin etc lib mnt proc run srv tmp var
|
|||||||
dev home media opt root sbin sys usr work
|
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
|
## Monitor mode
|
||||||
|
|
||||||
By default, when debugging, you'll be dropped into a shell in the final stage.
|
By default, when debugging, you'll be dropped into a shell in the final stage.
|
||||||
@ -93,7 +134,7 @@ immediately enter the monitor mode.
|
|||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker buildx debug-shell
|
$ docker buildx debug-shell
|
||||||
+] Building 0.0s (1/1) FINISHED
|
[+] Building 0.0s (1/1) FINISHED
|
||||||
=> [internal] connecting to remote controller
|
=> [internal] connecting to remote controller
|
||||||
(buildx) list
|
(buildx) list
|
||||||
ID CURRENT_SESSION
|
ID CURRENT_SESSION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user