构建 Dompteur 容器问题小记

本文记录了解决Dockerfile构建过程中遇到的权限错误、环境变量问题、网络下载失败以及Python包安装失败(缺少jpeg库)等错误的详细步骤。通过修改Dockerfile、增加依赖库安装和解决网络问题,最终成功构建了镜像。
摘要由CSDN通过智能技术生成

官方 Repo:https://github.com/RUB-SysSec/dompteur

这么小众的题材肯定没人看了,Github 都没有两颗星,虽然是四大hhh

首先 Clone,按照 readme 执行 ` docker build -t dompteur . `

第一个报错是权限不足,上一篇博客解决了这个问题

接下来是第二个报错,

/usr/bin/env: 'bash\r': No such file or directory

解决方案参照了:

Linux系统下运行bash脚本提示/usr/bin/env: ‘bash\r’: No such file or directory - Cqlismy - 博客园1、问题现象 在Linux系统中使用./make.sh运行了一个简单的bash脚本,运行失败,并报错提示如下所示: 2、错误原因: 主要是应用bash后面多了'\r'字符的原因,在Lihttps://www.cnblogs.com/Cqlismy/p/12888768.html用 vim 进去改了一下,继续执行,继续报错。

Step 8/15 : RUN chmod a+x extras/check_dependencies.sh &&    extras/check_dependencies.sh &&    make -j $(nproc) &&    ./extras/install_irstlm.sh
 ---> Running in 90e747f7cf0a
extras/check_dependencies.sh: 1: extras/check_dependencies.sh: !/usr/bin/env: not found
extras/check_dependencies.sh: 12: extras/check_dependencies.sh: function: not found
extras/check_dependencies.sh: 16: extras/check_dependencies.sh: Syntax error: "}" unexpected

首先说 没有这个路径,然后又说语法错误,估计是第一行的问题导致的,那就把第一行改成标准的 bash 文件开头。后来又报错又改回去反倒没有语法错误了。

wget: unable to resolve host address 'jaguar.ncsl.nist.gov'

# 还有很多被我省略了,下载进度和编译命令等

2022-03-09 13:01:47 (296 KB/s) - 'openfst-1.6.7.tar.gz.1' saved [1230836/1230836]

tar xozf openfst-1.6.7.tar.gz

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
Makefile:88: recipe for target 'openfst-1.6.7' failed
make: *** [openfst-1.6.7] Error 2


# 还有很多省略

make[3]: Entering directory '/root/kaldi/tools/sctk-2.4.10/src/sclite'
/bin/sh: 5: Syntax error: end of file unexpected (expecting "done")
makefile:171: recipe for target 'testinstalldirs' failed
make[3]: [testinstalldirs] Error 2 (ignored)

破案了,就是网络问题,导致 Github 之类的一些外国服务器上的文件下载出现问题,外国环境可以 build。build 前确保至少能访问 Github 这类网站并且不会掉。

这一段好不容易搞定,安装 python 包又卡住了。

 => ERROR [14/15] RUN pip3 install -r requirements.txt

* 这里我省略了很多不相关信息

#19 99.28 Building wheels for collected packages: pillow, future
#19 99.28   Running setup.py bdist_wheel for pillow: started
#19 99.95   Running setup.py bdist_wheel for pillow: finished with status 'error'
#19 99.95   Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-m4m2gxjc/pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp5w911g_upip-wheel- --python-tag cp36:
#19 99.95   /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
#19 99.95     warnings.warn(msg)
#19 99.95   running bdist_wheel

* 这里我省略了很多信息

#19 102.8     During handling of the above exception, another exception occurred:
#19 102.8
#19 102.8     Traceback (most recent call last):
#19 102.8       File "<string>", line 1, in <module>
#19 102.8       File "/tmp/pip-build-m4m2gxjc/pillow/setup.py", line 1037, in <module>
#19 102.8         raise RequiredDependencyException(msg)
#19 102.8     __main__.RequiredDependencyException:
#19 102.8
#19 102.8     The headers or library files could not be found for jpeg,
#19 102.8     a required dependency when compiling Pillow from source.
#19 102.8
#19 102.8     Please see the install instructions at:
#19 102.8        https://pillow.readthedocs.io/en/latest/installation.html
#19 102.8

搜了一下解决方案如下:

python - "The headers or library files could not be found for jpeg" installing Pillow on Alpine Linux - Stack Overflowhttps://stackoverflow.com/questions/44043906/the-headers-or-library-files-could-not-be-found-for-jpeg-installing-pillow-on加入了一行  `RUN apt install -y libjpeg-dev zlib1g-dev ` ,(不加 -y 的话会提示操作,导致脚本继续报错),之后的 Dockerfile 部分如下。

# Build Kaldi
ADD kaldi/src /root/kaldi/src
WORKDIR /root/kaldi/src
RUN ./configure --shared &&\
    make depend -j $(nproc) &&\
    make -j $(nproc) || true

WORKDIR /root
ADD requirements.txt /root/requirements.txt
RUN apt install -y libjpeg-dev zlib1g-dev 
RUN pip3 install -r requirements.txt

ADD kaldi/wsj_recipe /root/kaldi/wsj_recipe

再次 Build 终于成功了,激动之情难以言表啊

 跑起来了,但是好像 Windows 的 Docker Desktop 不能调整 image 的存储路径……需要搞什么 WSL2 的配置,然后我想把它的 image 单独拿出来存储结果发现和别的 image 是一起存放在一个超级大文件里的。。。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值