Update Dockerfile

I made some small changes to the docker file, including:

1- Combined the apt-get update and apt-get install commands into a single RUN statement to reduce the number of layers in the Docker image.
2- Added the --no-install-recommends flag to apt-get install to exclude unnecessary recommended packages.
3- Moved the installation of tshark to the same apt-get install command to avoid redundant package updates.
4- Added the && operator to concatenate multiple commands in a single RUN statement, improving build efficiency.
This commit is contained in:
aria1991 2023-04-28 21:53:09 +02:00 committed by GitHub
parent e52c275bc5
commit 4f9a09c444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 7 deletions

View File

@ -1,17 +1,31 @@
FROM python:3.6-stretch
# Set the root password in the container so we can use it
RUN echo "root:Docker!" | chpasswd
RUN apt-get -y update
RUN apt-get -y install libnetfilter-queue-dev iptables tcpdump netcat net-tools git graphviz openssh-server
# Update package lists and install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
libnetfilter-queue-dev \
iptables \
tcpdump \
netcat \
net-tools \
git \
graphviz \
openssh-server \
tshark
# Enable root SSH login for client testing
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install tshark
ENV PATH="/usr/sbin:${PATH}"
# Install Python dependencies
RUN pip install netfilterqueue requests dnspython anytree graphviz netifaces paramiko tld docker scapy==2.4.3 psutil
ENV PATH="/usr/sbin:${PATH}"
ENTRYPOINT ["/bin/bash"]