Reputation: 21
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?
Dev environment: Ubuntu 22.04
Prod environment: 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"]
When building this file on my dev system (Ubuntu 22.04) it works fine.
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
solo on my server installs the package fine./etc/apt/sources.list
Upvotes: 2
Views: 3589
Reputation: 4598
Instead of fixing the problem, I downloaded .deb
and installed it, in my case with gdebi
but you can also use dpkg
.
RUN echo "### Install wkhtmltopdf ###" \
&& wget -nv -O /tmp/wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb \
&& gdebi --non-interactive /tmp/wkhtmltopdf.deb
Upvotes: 0
Reputation: 21
I found the solution, problem was nftables and docker. Docker adds iptables rules to the ruleset, all I have to do was this:
- use an ip and ipv6 table instead of inet
- name all chains exactly as in iptables: INPUT, OUTPUT & FORWARD
source: https://ehlers.berlin/blog/nftables-and-docker/
Upvotes: 0
Reputation: 67
According to Docker docs:
Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.
So for your case, you should do:
RUN apt-get update && apt-get install -y wkhtmltopdf
Instead of:
RUN apt-get update
RUN apt-get install -y wkhtmltopdf
Upvotes: 5