Browse code

Fix pid=host example in documentation

The existing example didn't illustrate how to
install strace in the container. In addition,
the rhel7 image used is no longer public (and maintained)
so not a good image to use in the example.

This updates the example to use htop (strace is
not working without disabling apparmor for the container)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2015/12/08 22:52:58
Showing 1 changed files
... ...
@@ -206,10 +206,27 @@ on the system.  For example, you could build a container with debugging tools
206 206
 like `strace` or `gdb`, but want to use these tools when debugging processes
207 207
 within the container.
208 208
 
209
-    $ docker run --pid=host rhel7 strace -p 1234
209
+### Example: run htop inside a container
210 210
 
211
-This command would allow you to use `strace` inside the container on pid 1234 on
212
-the host.
211
+Create this Dockerfile:
212
+
213
+```
214
+FROM alpine:latest
215
+RUN apk add --update htop && rm -rf /var/cache/apk/*
216
+CMD ["htop"]
217
+```
218
+
219
+Build the Dockerfile and tag the image as `myhtop`:
220
+
221
+```bash
222
+$ docker build -t myhtop .
223
+```
224
+
225
+Use the following command to run `htop` inside a container:
226
+
227
+```
228
+$ docker run -it --rm --pid=host myhtop
229
+```
213 230
 
214 231
 ## UTS settings (--uts)
215 232