目前VeraCrypt对于Debian系统所支持的最新版本是Debian11
https://www.veracrypt.fr/en/Downloads.html
docker run -dit --name veracrypt --privileged debian:11
docker exec -it veracrypt bash
apt install wget
# 到官网找到最新版本文件链接
wget https://launchpad.net/veracrypt/trunk/1.25.9/+download/veracrypt-console-1.25.9-Debian-11-amd64.deb
apt install ./veracrypt-console-1.25.9-Debian-11-amd64.deb
veracrypt --help
veracrypt -m=nokernelcrypto volume.hc /media/veracrypt1
主要是--privileged
这个参数,提升容器特权
运行veracrypt时添加-m=nokernelcrypto
参数表示不用内核加密服务否则报错
Dockerfile
FROM debian:11
# 替换清华源,服务器在国外可删除此项
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
# 安装需要的包
&& apt update && apt install -y vim locales python3 ipython3 wget \
&& wget https://launchpad.net/veracrypt/trunk/1.25.9/+download/veracrypt-console-1.25.9-Debian-11-amd64.deb \
&& apt install -y ./veracrypt-console-1.25.9-Debian-11-amd64.deb \
# 加载 https://github.com/amix/vimrc 的vim配置
&& wget --timeout 10 https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/basic.vim -O ~/.vimrc \
|| wget --timeout 10 https://p.ooe.ooo/https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/basic.vim -O ~/.vimrc \
# 修复中文显示乱码
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& sed -i '/zh_CN.UTF-8/s/^# //g' /etc/locale.gen \
&& sed -i '/zh_CN.GBK/s/^# //g' /etc/locale.gen \
&& sed -i '/zh_CN/s/^# //g' /etc/locale.gen \
&& locale-gen \
# 快捷命令
&& echo "alias veracryptp='veracrypt -t -k \"\" --pim=0 --protect-hidden=no -m=nokernelcrypto'" >> ~/.bashrc \
&& echo 'alias ipython=ipython3' >> ~/.bashrc \
&& echo 'alias python=python3' >> ~/.bashrc
ENV LANG=zh_CN.UTF-8
编译
docker build -t veracrypt .
运行
docker run --privileged --rm -it --net=none -v /host/path/:/src --name veracrypt-container veracrypt