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.
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
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/
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
Related
We are using Azure Pipelines with build agents using Ubuntu 18.04 as OS.
I am currently trying to update the Nodejs version in our pipelines from 16 to 18. Installation of Nodejs is simple enough by using the NodeTool task from Azure Pipelines with versionSpec: "18.x".
However upon using Nodejs afterwards it prompts me for a missing dependency:
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)\
I can even replicate this behavior using docker with the following instructions
docker pull ubuntu:18.04
docker run -it {IMAGE-ID}
# console switches to TTY session for running container…
apt update
apt install curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash
apt-get install -y nodejs
# checking the node version generates the error above
node -v
The question here might be a little bit overboard, but I am not used to working with linux systems.
Can i easily resolve this dependency for nodejs?
Or what would be the general approach here to install the missing dependency?
This message comes during the installation process you mentioned above.
## Run sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/enter code hereshare/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-enter code hereby=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.denter code here/yarn.list
sudo apt-get update && sudo apt-get install yarn
I tried that, but still same error.
So after a little research it seams that node 18 and ubuntu 18 are not combatible.
https://github.com/nodesource/distributions/issues/1392
If you google the error you will find more about this issue.
Updating to ubuntu 20.04 should fix the problem.
If you dont need ubuntu for some other reasons than nodejs, i would suggest you to try node:18-alpine. (one of the ufficial nodejs images). Alpine is much more lightweigth than ubuntu.
I wrote this Dockerfile for an os
FROM randomdude/gcc-cross-x86_64-elf
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nasm
RUN apt-get install -y xorriso
RUN apt-get install -y grup-pc-bin
RUN apt-get install -y grup-common
VOLUME /
WORKDIR /
and while running sudo docker build buildenv -t testos-buildenv
on the terminal i got this log
Sending build context to Docker daemon 2.048kB
Step 1/9 : FROM randomdude/gcc-cross-x86_64-elf
---> c7e17c42eb04
Step 2/9 : RUN apt-get update
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
---> Running in 32e48dbf4a9c
exec /bin/sh: exec format error
The command '/bin/sh -c apt-get update' returned a non-zero code: 1
this file is inside /home/user/Desktop/os-systems/test-os/buildenv
i need help to solve it
Of course..It is for x86.
It depends on what you want to do.
If you want use it on your os. You have to build an arm64 version image. You have to replace some x86 dependences in the original Dockerfile and re-build it.
This Dockerfile is mentioned by the base image's description you use.
If you want use a x86 image but just want to build it on your OS (arm64), then you could try to use buildx.
I am Running docker on an M1 Macbook Pro , here i am using this docker script
FROM node:current-buster
# Create and set user
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update && apt install -y ./google-chrome-stable_current_amd64.deb
This throws an error
google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.16) but it is not installable
and same for other dependencies
I have tried various ways:
changing base image
changing the installation step to
apt-get install -y wget gnupg ca-certificates procps libxss1 &&
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'&&
apt-get update &&
apt-get install -y google-chrome-stable
(This gives an error unable to locate package)
The script runs on a linux machine but for m1 mac it doesnt work.
I actually wanted to run puppeteer inside docker for which i am trying to install chrome incase there is an another way around.
docker buildx build --platform=linux/amd64
This allows us to build the image atleast. Not sure if running it would produce the same result on M1 machine but atleast the image is built
EDIT::
so chrome has no arm image and that was the main cause for this problem changing it to chromium on base ubuntu 18.04 seems to work fine
FROM ubuntu:18.04
RUN apt-get install -y chromium-browser
It should work on both debian and ubuntu, try first to run sudo apt update after that it was able to install arm build of chromium.
My Dockerfile wants some package not-here-yet that is not in the registered repositories.
RUN yum install -d 1 -y not-here-yet && yum clean all
This fails as expected. But because the container does not have dnf, the below returns exit code 0 even though it has the same problem.
RUN yum install -d 1 -y inotify-tools not-here-yet && yum clean all
yum's poor validation in this area leaves me with an incomplete container unless the Dockerfile's maintainer knows what commands make not-here-yet available.
Assuming for policy reasons that I cannot install dnf on this container, how do I make yum fail if any one package is not found in a list without copying the same RUN line over and over again to install one package at a time?
I want to install netstat on my Docker container.
I looked here https://askubuntu.com/questions/813579/netstat-or-alternative-in-docker-ubuntu-server-16-04-container so I'm trying to install it like this:
apt-get install net-tools
However, I'm getting:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package net-tools
So how can I install netstat?
You need to run apt-get update first to download the current state of the package repositories. Docker images do not include this to save space, and because they'd likely be outdated when you use it. If you are doing this in a Dockerfile, make sure to keep it as a single RUN command so that caching of the layers doesn't cache an old version of the update command with a new package install request:
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
net-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
netstat is provided by the net-tools package,net-tools is probably not installed by default in the Docker image for Ubuntu 16.04 to keep the image size as small as possible.
Execute the following commands inside docker container:
apt update
apt install net-tools