September 7, 2018 · Docker dockerfile dhcp

Dockerized Glass - ISC DHCP Server Interface

I have a ISC DHCP server which provides my lab environment with IP addreses and I was curious if there was a GUI that would allow one to view leases and other information. As it happens it does. I found the Glass project on github.

However it had the requirement of running nodejs on my precious DHCP server. I was sceptical but gave it a try. I did enjoy the Glass application and decided that running docker on my server was somewhat better than installing nodejs.

This is how I dockerized Glass.

mkdir glass && cd glass

vim Dockerfile

FROM node:8-slim  
MAINTAINER dodgydudes  
RUN apt-get update && apt-get -y --no-install-recommends install git && git clone https://github.com/Akkadius/glass-isc-dhcp.git /opt/glass  
WORKDIR /opt/glass  
RUN mkdir logs && chmod u+x ./bin/ -R && chmod u+x *.sh && npm install  
VOLUME /var/lib/dhcp/dhcpd.leases /var/log/dhcp.log /etc/dhcp/dhcpd.conf /opt/glass/config  
EXPOSE 3000  
ENTRYPOINT ["npm", "start"]  

Build the image.

docker build -t glass .

Create a volume to store the Glass configuration file.

docker volume create glass-config

Find where your dhcpd.leases, dhcp.log and dhcpd.conf are located, you need to bind mount them to the docker container. Below you can see where they were on my CentOS 7 system.

docker run --name glass --hostname dhcp -tid \  
-v /var/lib/dhcpd/dhcpd.leases:/var/lib/dhcp/dhcpd.leases:ro \
-v /var/log/dhcp.log:/var/log/dhcp.log:ro \
-v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf:ro \
-v glass-config:/opt/glass/config -p 3000:3000 glass:latest

Note: Beware of trailing spaces above. Better watch that copypasta!

Nice huh?

Nice