Skip to content

Commit

Permalink
Merge pull request #4 from jonathadv/feature-htop-poiting-to-host-proc
Browse files Browse the repository at this point in the history
Build `htop` from source so that it can see host's processes
  • Loading branch information
jonathadv authored Dec 9, 2017
2 parents 3bd765b + 817150d commit 89ab896
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Using a build stage in order to build htop using the flag `--with-proc=/proc_host`
# which allows it to use a custom location instead of `/proc`.
FROM alpine:3.6 as builder

WORKDIR /build
RUN apk add --update alpine-sdk build-base ncurses-dev autoconf automake curl unzip
RUN curl -L https://github.com/hishamhm/htop/archive/master.zip --output htop.zip
RUN unzip htop.zip
RUN cd htop-master

WORKDIR /build/htop-master
RUN sh autogen.sh
RUN sh configure --prefix=/build/htop-master/dist --with-proc=/proc_host
RUN make
RUN make install


# Main Container
FROM alpine:3.6

MAINTAINER Jonatha Daguerre <[email protected]>
Expand All @@ -6,7 +24,6 @@ RUN apk add --no-cache \
bash \
bind-tools \
curl \
htop \
iptraf-ng \
iotop \
jq \
Expand All @@ -19,3 +36,4 @@ RUN apk add --no-cache \
tcpdump \
vim

COPY --from=builder /build/htop-master/dist/bin/htop /usr/local/bin/
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project focus on providing system administration and troubleshooting tools
* **bash** - GNU Bourne-Again SHell.
* **bind-tools** - The ISC DNS tools (dig, nslookup, host).
* **curl** - Tool to transfer data from or to a server.
* **htop** - A ncurses-based process viewer for Linux.
* **htop** - A ncurses-based process viewer for Linux. (built from source, allows to watch the **host's processes**)
* **iotop** - Simple top-like I/O monitor.
* **iptraf-ng** - An IP Network Monitoring tool.
* **jq** - Commandline JSON processor.
Expand All @@ -27,7 +27,9 @@ This project focus on providing system administration and troubleshooting tools

Use `--net=host` allows `tcpdump` to access the host's network interfaces.

Optionally you can create a local directory and map it to the container:
Use `-v /proc:/proc_host` allows `htop` to watch the host's processes. Note that `htop` is unable to kill any host's processes.

Optionally you can create a local directory and map it to the container like `-v /tmp/data/:/tmp/data/`:

```bash
mkdir /tmp/data
Expand All @@ -36,6 +38,7 @@ docker run \
--rm \
--name toolkit \
--net=host \
-v /proc:/proc_host \
-v /tmp/data/:/tmp/data/ \
-it \
jonathadv/admin-toolkit \
Expand Down

0 comments on commit 89ab896

Please sign in to comment.