From 9b6592ca858a23376b838e9808d7fa3f15ebc381 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 8 Dec 2015 14:52:58 +0100 Subject: [PATCH] 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 --- docs/reference/run.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/reference/run.md b/docs/reference/run.md index 53ab5ea350..9288dd21d5 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -206,10 +206,27 @@ on the system. For example, you could build a container with debugging tools like `strace` or `gdb`, but want to use these tools when debugging processes within the container. - $ docker run --pid=host rhel7 strace -p 1234 +### Example: run htop inside a container -This command would allow you to use `strace` inside the container on pid 1234 on -the host. +Create this Dockerfile: + +``` +FROM alpine:latest +RUN apk add --update htop && rm -rf /var/cache/apk/* +CMD ["htop"] +``` + +Build the Dockerfile and tag the image as `myhtop`: + +```bash +$ docker build -t myhtop . +``` + +Use the following command to run `htop` inside a container: + +``` +$ docker run -it --rm --pid=host myhtop +``` ## UTS settings (--uts)