buildx icon indicating copy to clipboard operation
buildx copied to clipboard

monitor: on-error: support long-form for allowing configuring the container

Open ktock opened this issue 2 years ago • 1 comments

This commit introduces type=on-error option to the long form of --invoke. This allows users specifying shell command (default is /bin/sh) to run in the container with on-error mode.

Short form of on-error (/bin/sh is launched):

$ BUILDX_EXPERIMENTAL=1 /tmp/out/buildx build --progress=plain --invoke on-error /tmp/ctx4
...
Launching interactive container. Press Ctrl-a-c to switch to monitor console
Interactive container was restarted with process "xx3sxqjypyforw6zhbuegfu0q". Press Ctrl-a-c to switch to the new container
# ps auxww
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.2  0.0   2888   984 pts/0    Ss   12:33   0:00 /bin/sh
root           7  0.0  0.0   7060  1556 pts/0    R+   12:34   0:00 ps auxww

Long form of on-error (bash is launched):

$ BUILDX_EXPERIMENTAL=1 /tmp/out/buildx build --progress=plain --invoke 'type=on-error,args=bash' /tmp/ctx4
...
Launching interactive container. Press Ctrl-a-c to switch to monitor console
Interactive container was restarted with process "oi0qk0guub5e5qp9kogiit8te". Press Ctrl-a-c to switch to the new container
root@buildkitsandbox:/# ps auxww
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.6  0.0   4628  3604 pts/0    Ss   12:36   0:00 bash
root           9  0.0  0.0   7060  1552 pts/0    R+   12:37   0:00 ps auxww

ktock avatar Jun 27 '23 13:06 ktock

@ktock Has this been superseded by other PRs that are already merged?

tonistiigi avatar Oct 25 '23 16:10 tonistiigi