Fil*_*lla 2 linux ubuntu debian apt docker
在排除故障时,我遇到了不同的错误:
...
Err:1 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
...
Run Code Online (Sandbox Code Playgroud)
我猜这与我的防火墙设置(nftables)有关运行docker run busybox nslookup google.com
给了我
;; connection timed out; no servers could be reached所以docker没有与外部的连接?
开发环境:Ubuntu 22.04
生产环境:debian 10.12 64bit / Linux 4.19.0-20-amd64
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"]
Run Code Online (Sandbox Code Playgroud)
在我的开发系统(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
Run Code Online (Sandbox Code Playgroud)
apt-get install -y wkhtmltopdf可以很好地安装该软件包。/etc/apt/sources.list小智 5
根据Docker 文档:
在 RUN 语句中单独使用 apt-get update 会导致缓存问题,并且后续 apt-get install 指令会失败。
因此,对于您的情况,您应该这样做:
RUN apt-get update && apt-get install -y wkhtmltopdf
Run Code Online (Sandbox Code Playgroud)
代替:
RUN apt-get update
RUN apt-get install -y wkhtmltopdf
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2382 次 |
| 最近记录: |