新建Dockerfile,然后粘贴如下代码
FROM debian:latest
RUN sed -i 's/archive.ubuntu.com/mirror.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirror.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN echo deb http://mirrors.tuna.tsinghua.edu.cn/debian sid main >> /etc/apt/sources.list
RUN apt update
RUN apt install gdebi -y
RUN apt install wget -y
RUN apt install libndpi-dev -y
WORKDIR /app/
RUN wget -P /app/ https://phoenixnap.dl.sourceforge.net/project/capanalysis/version%201.2.3/capanalysis_1.2.3_amd64.deb
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d
# ENV DEBIAN_FRONTEND noninteractive
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
RUN gdebi --n /app/capanalysis_1.2.3_amd64.deb
RUN sed -i -e 's/PRIORITY=1 #(0..20)/PRIORITY=0 #(0..20)Z/g' /etc/init.d/capanalysis
RUN apt install sudo
ADD upload.ini /etc/php/7.3/apache2/conf.d
CMD sudo service postgresql restart && \
sudo service apache2 restart && \
sudo service capanalysis restart && \
tail -f /var/log/apache2/access.log
VOLUME /var/lib/postgresql
VOLUME /opt/capanalysis
EXPOSE 9877
同目录新建 upload.ini,进行上传配置:
file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
构建生成docker镜像
docker build -t sking/capanyly:lastest .
导出文件
docker save sking/capanyly:lastest -o aaa