Create a Dockerfile
# Use official Kali images as basic imagesFROM kalilinux/kali-rolling # Set up the working directoryWORKDIR /app # Copy all files in the current directory to the working directoryCOPY ./ . RUN chmod +x /app/ # Install project dependenciesRUN apt update -y RUN apt upgrade -y # Install Chinese font supportapt install ttf-wqy-zenhei ttf-wqy-microhei -y RUN apt install dbus-x11 xfce4 tightvncserver x11vnc xauth git -y RUN git clone /novnc/ RUN echo -e "<password>\n<password>\n" | vncpasswd -f # Expose the 8080 port of the containerEXPOSE 5901 EXPOSE 6080 # Set commands to run when container startsCMD ["/app/"]
create
echo "#! /bin/bash" > echo "rm /tmp/.X11-unix/X1 -rf" >> echo "rm /tmp/.X1-lock" >> echo "su - root -c 'vncserver :1'" >> echo "/app/noVNC/utils/novnc_proxy --vnc localhost:5901" >>
Generate Images
Run the Dockerfile directory to use the command
docker build -t kali-novnc:latest . # Command introduction:# docker: docker command.# build: compile.# -t: The name and tag of the mirror, usually name: tag or name format; multiple tags can be set for one image in a single build, refer to the docker build command to explain in detail.# kali-novnc: The name of the generated image.# latest: The version number of the generated image.# .:Point symbol“.”It means,Directory for specifying the context environment during the image build process,Can refer todocker build After the command . This article means。
Create a container
docker run -itd --name kali -p83:6080 -p5901:5901 --restart=always kali-novnc
This is the end of this article about creating kali-novnc through Dockerfile. For more related content on creating kali-novnc for Dockerfile, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!