1oc-inject(1) oc-inject(1)
2
3
4
6 oc-inject - Copy and run an executable into an OpenShift container
7
9 oc-inject pod-ID [-c container-ID] executable
10 oc-inject pod-ID [-c container-ID] -- executable args...
11
13 Copy an executable into an OpenShift container and run the executable.
14
15 oc-inject is a tool for last-resort troubleshooting of a running con‐
16 tainer, when a required debugging tool is not present in the container
17 image.
18
19 oc-inject collects an executable from the local system together with
20 the minimal dependencies (shared libraries and ld.so loader binary) re‐
21 quired to run it, then copies the executable and dependencies into an
22 OpenShift container by invoking oc cp. oc-inject then runs the exe‐
23 cutable by invoking oc exec. This can be used to install and run basic
24 debugging tools such as gdbserver and strace into running containers
25 that would otherwise lack debugging facilities.
26
28 The following command installs strace from the local machine into the
29 first container in pod myapp-zrblm and invokes it to trace all syscalls
30 made by the process with PID 414:
31
32 $ oc-inject -it myapp-zrblm -- strace -p 414
33
34 The following commands install the gdbserver executable from the local
35 machine into the first container in pod myapp-zrblm and request a back‐
36 trace of all threads in the process with PID 23:
37
38 $ gdb
39 (gdb) target extended-remote | ./oc-inject -i myapp-zrblm -- gdbserver --multi -
40 (gdb) attach 23
41 (gdb) thread apply all bt
42
44 -c container-ID, --container container-ID
45 Name of target container in the pod. If omitted, the first con‐
46 tainer in the pod will be chosen.
47
48 --custom-loader custom-loader
49 Use a custom loader binary instead of ld.so.
50
51 -h, --help
52 Show a help message and exit.
53
54 -i, --stdin
55 For interactive programs: pass stdin to the container.
56
57 --java Treat executable as a JDK tool: copy and load additional Java
58 libraries.
59
60 -n, --dry-run
61 Output the oc commands that would be used to copy and run the
62 executable, but do not execute them.
63
64 --oc-command oc
65 Use a custom command instead of oc to access the container. For
66 example, use --oc-command=kubectl to access a Kubernetes con‐
67 tainer.
68
69 -s, --static
70 Treat executable as a static binary: do not copy any dependen‐
71 cies.
72
73 -t, --tty
74 For interactive programs: treat stdin passed to the container as
75 a TTY.
76
77 -T custom-tmpdir, --custom-tmpdir custom-tmpdir
78 Use a custom temporary directory for collecting the executable
79 and dependencies.
80
81 -v, --verbose
82 Output the oc commands used to copy and run the executable.
83
85 See GitHub Issues: <https://github.com/serhei/oc-inject/issues>
86
88 Serhei Makarov <smakarov@redhat.com>
89
91 https://github.com/serhei/oc-inject
92
94 oc(1), oc-exec(1), kubectl(1), ldd(1), ld.so(8)
95
96
97
98version 0.7.9 oc-inject(1)