docker无法找到包装(WKHTMLTOPDF)
在故障排除时编辑
我会遇到不同的错误:
...
Err:1 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
...
我猜这与我的防火墙设置有关(nftables) 运行
docker运行busybox nslookup google.com 给我;;连接时间出现;无法达到服务器
,因此Docker与外部没有连接?
系统
开发环境:Ubuntu 22.04
产品环境:debian 10.12 64bit / linux 4.19.0-20-AMD64 < / code>
dockerfile在我的节点后端文件夹内
FROM node:slim
# Install wkhtmltopdf
RUN apt-get update
RUN apt-get install -y wkhtmltopdf
RUN npm install -g pm2@latest
WORKDIR /var/api
COPY . .
RUN npm i
EXPOSE 10051-10053
# Start PM2 as PID 1 process
ENTRYPOINT ["pm2-runtime"]
CMD ["process.json"]
构建此文件时,在我的dev System(Ubuntu 22.04)上构建此文件时,效果很好。
但是,部署它去我的服务器并让它构建,我得到了此输出:
Building backend
Sending build context to Docker daemon 159.2kB
Step 1/10 : FROM node:slim
---> 6c8b32c67190
Step 2/10 : RUN apt-get update
---> Using cache
---> b28ad6ee8ebf
Step 3/10 : RUN apt-get install -y wkhtmltopdf
---> Running in 2f76d2582ac0
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package wkhtmltopdf
The command '/bin/sh -c apt-get install -y wkhtmltopdf' returned a non-zero code: 100
ERROR: Service 'backend' failed to build : Build failed
我尝试过
- 运行
apt -get install -y wkhtmltopdf
在我的服务器上独奏,请安装软件包。 - 添加了不同回归
/etc/apt/sources.list
- 我知道它的软件包 https://packages.debian.org/buster/wkhtmltopdf (?)
- 一些故障排除。
EDIT
While troubleshooting I'm getting different errors:
...
Err:1 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
...
I'm guessing it has something to do with my firewall settings(nftables)
Runningdocker run busybox nslookup google.com
gives me;; connection timed out; no servers could be reached
so the docker has no connection to the outside?
Systems
Dev environment: Ubuntu 22.04
Prod environment: debian 10.12 64bit / Linux 4.19.0-20-amd64
Dockerfile inside my node backend folder
FROM node:slim
# Install wkhtmltopdf
RUN apt-get update
RUN apt-get install -y wkhtmltopdf
RUN npm install -g pm2@latest
WORKDIR /var/api
COPY . .
RUN npm i
EXPOSE 10051-10053
# Start PM2 as PID 1 process
ENTRYPOINT ["pm2-runtime"]
CMD ["process.json"]
When building this file on my dev system (Ubuntu 22.04) it works fine.
However, deploying it go my server and letting it build, I get this output:
Building backend
Sending build context to Docker daemon 159.2kB
Step 1/10 : FROM node:slim
---> 6c8b32c67190
Step 2/10 : RUN apt-get update
---> Using cache
---> b28ad6ee8ebf
Step 3/10 : RUN apt-get install -y wkhtmltopdf
---> Running in 2f76d2582ac0
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package wkhtmltopdf
The command '/bin/sh -c apt-get install -y wkhtmltopdf' returned a non-zero code: 100
ERROR: Service 'backend' failed to build : Build failed
What I have tried
- Running
apt-get install -y wkhtmltopdf
solo on my server installs the package fine. - Added different repos to the
/etc/apt/sources.list
- I know its package https://packages.debian.org/buster/wkhtmltopdf (?)
- Some troubleshooting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 docker docs :
因此,对于您的情况,您应该这样做:
而不是:
According to Docker docs:
So for your case, you should do:
Instead of:
我发现了解决方案,问题是Nftables和Docker。
Docker在规则集中添加了iPtables规则,我要做的就是这样:
来源:
I found the solution, problem was nftables and docker.
Docker adds iptables rules to the ruleset, all I have to do was this:
source: https://ehlers.berlin/blog/nftables-and-docker/
在我的情况下,我没有解决问题,而是下载了
.deb
并安装了它,并使用gdebi
,但您也可以使用dpkg
。Instead of fixing the problem, I downloaded
.deb
and installed it, in my case withgdebi
but you can also usedpkg
.