Sign inSign up

jaromaz/cnt-http-ident

By jaromaz

•Updated over 6 years ago

A small container [4MB] with a web server displaying the container id, host and IP.

Image
0

1.1K

jaromaz/cnt-http-ident repository overview

⁠Container HTTP ident

A small container (4MB - based on the Busybox) with a web server running on port 80 displaying the container ID, hostname and IP. Darkhttpd was used as a simple, fast HTTP web server for static content.

⁠Running

docker run -d -p 8080:80 --rm jaromaz/cnt-http-ident

Then simply point your browser at: http://YourDockerIP:8080⁠

⁠Dockerfile

FROM busybox:musl
COPY root.tar.gz /
RUN adduser darkhttpd -h /var/www/html -G www-data -D -s /bin/false -g darkhttpd \
    && tar zxf root.tar.gz \
    && rm root.tar.gz \
    && mkdir -p /var/log/darkhttpd \
    && touch /var/log/darkhttpd/access.log \
    && chown -R www-data:www-data /var/www/html/*
ENTRYPOINT sed -i "s/cnt_host/$(cat /etc/hostname)/g" /var/www/html/index.html \
    && sed -i "s~cnt_id~$(grep 'et:/do' /proc/self/cgroup | cut -f 3 -d: | cut -b 9-20)~g" \
    /var/www/html/index.html \
    && sed -i "s/cnt_ip/$(ip addr show dev eth0 | \
    awk -F '[ /\t]+' '$2=="inet"{print $3; exit}')/g" /var/www/html/index.html \
    && /usr/bin/darkhttpd ${document_root:-/var/www/html} --chroot --uid darkhttpd \
    --gid www-data --log /var/log/darkhttpd/access.log

For more information please visit my website: https://jm.iq.pl⁠.

Tag summary

Content type

Image

Digest

Size

4.2 MB

Last updated

over 6 years ago

docker pull jaromaz/cnt-http-ident