Dockerizing CoreSecFrame

Build a Docker image based on Kali Linux with CoreSecFrame automatically cloned and installed.

Overview

This guide walks you through creating a Docker image for CoreSecFrame, based on Kali Linux, by directly cloning the official GitHub repository. This means you won't need to copy any local files into the container; the Dockerfile handles everything.

1. Create the Dockerfile

In your project folder, or any directory you choose for building the image, create a file named Dockerfile and copy in the following content:

FROM kalilinux/kali-rolling:latest

FROM kalilinux/kali-rolling

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip tmux git wget ca-certificates sudo && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone https://github.com/CoreSecFrame/CoreSecFrame.git coresecframe
WORKDIR /opt/coresecframe

RUN pip3 install --break-system-packages --upgrade pip
RUN pip3 install --break-system-packages -r requirements.txt

RUN ln -s /opt/coresecframe/main.py /usr/local/bin/coresecframe && chmod +x /usr/local/bin/coresecframe

CMD ["coresecframe"]

This Dockerfile does the following:

  • Uses kalilinux/kali-rolling as the base image.
  • Installs Python, pip, git, and other necessary packages.
  • Clones the CoreSecFrame code from GitHub into /opt/coresecframe.
  • Installs Python dependencies from requirements.txt.
  • Creates a simple symbolic link to run coresecframe anywhere.
  • Sets coresecframe as the default command.

2. Build the Docker Image

Open a terminal in the same folder as your Dockerfile and run:

docker build -t coresecframe .

This command tells Docker to build an image tagged as coresecframe using the current directory (dot .) as the build context. Once finished, you’ll have a new Docker image named “coresecframe” that contains Kali plus CoreSecFrame.

3. Run a Container

Create and start a container from the newly built image with:

docker run -it --rm coresecframe

-it provides an interactive terminal, and --rm removes the container once it stops, keeping your system clean of unused containers. By default, this runs the CMD ["coresecframe"] specified in the Dockerfile.

4. (Optional) Shell Access

If you want to explore or troubleshoot inside the container, you can override the default command with /bin/bash:

docker run -it --rm coresecframe /bin/bash

This drops you into a Bash shell within the container, allowing you to inspect files, manually run coresecframe, or perform any additional tasks.