Since recently discovering there is now an official Kali Linux docker image, I’ve been fiddling with it and tweaking my own setup to get it to how I like it for the things I use it for. I have a work version and a personal version. What follows is my personal version, used mostly for R&D, CTF challenges, and bug hunting in my free time.
My Kali Dockerfile (for Mac)
# The Kali linux base image FROM kalilinux/kali-linux-docker # Update all the things, then install my personal faves RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install -y \ cadaver \ dirb \ exploitdb \ exploitdb-bin-sploits \ git \ gdb \ gobuster \ hashcat \ hydra \ man-db \ medusa \ minicom \ nasm \ nikto \ nmap \ sqlmap \ sslscan \ webshells \ wpscan \ wordlists # Create known_hosts for git cloning things I want RUN mkdir /root/.ssh RUN touch /root/.ssh/known_hosts # Add host keys RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts RUN ssh-keyscan github.com >> /root/.ssh/known_hosts # Clone git repos RUN git clone https://github.com/danielmiessler/SecLists.git /opt/seclists RUN git clone https://github.com/PowerShellMafia/PowerSploit.git /opt/powersploit RUN git clone https://github.com/hashcat/hashcat /opt/hashcat RUN git clone https://github.com/rebootuser/LinEnum /opt/linenum RUN git clone https://github.com/maurosoria/dirsearch /opt/dirsearch RUN git clone https://github.com/sdushantha/sherlock.git /opt/sherlock # Other installs of things I need RUN apt-get install -y \ python-pip RUN pip install pwntools # Update ENV ENV PATH=$PATH:/opt/powersploit ENV PATH=$PATH:/opt/hashcat ENV PATH=$PATH:/opt/dirsearch ENV PATH=$PATH:/opt/sherlock # Set entrypoint and working directory (Mac specific) WORKDIR /Users/wchatham/kali/ # Expose ports 80 and 443 EXPOSE 80/tcp 443/tcp
docker build -t yourname/imagename path/to/theDockerfile
(don’t actually put ‘Dockerfile’ in the path). Do change ‘imagename’ to something apropos, such as ‘kali’
docker run -ti -p 80:80 -p 443:443 -v /Users/yourname/Desktop:/root yourname/imagename
The above examples require you to replace ‘yourname’ with your Mac username
Indicates that we want a tty and to keep STDIN open for interactive processes
Expose the listed ports
Mount the defined folders to be shared from host to docker.
Hope that’s useful to someone!