how to resolve docker throwing Error on Centos 7 VM - azure

I have installed docker on my centos 7 VM running on Azure. I used below commands to install docker:
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
After successfully installing docker, I'm getting below error. Can someone please suggest what could be the problem.
sudo docker --version
runtime: s.allocCount= 37 s.nelems= 73
fatal error: s.allocCount != s.nelems && freeIndex == s.nelems
goroutine 1 [running, locked to thread]:
runtime.throw({0x562d045c5c70?, 0x7fb997110112?})
/usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc0001def58 sp=0xc0001def28 pc=0x562d032fb1d1
runtime.(*mcache).nextFree(0x7fb997110108, 0x12)
/usr/local/go/src/runtime/malloc.go:884 +0x1e5 fp=0xc0001defa0 sp=0xc0001def58 pc=0x562d032d3085
runtime.mallocgc(0x70, 0x562d04d1cea0, 0x1)
/usr/local/go/src/runtime/malloc.go:1085 +0x4e5 fp=0xc0001df018 sp=0xc0001defa0 pc=0x562d032d35a5
runtime.newobject(0x562d04c463a0?)
/usr/local/go/src/runtime/malloc.go:1259 +0x27 fp=0xc0001df040 sp=0xc0001df018 pc=0x562d032d3ae7
regexp/syntax.(*Regexp).Simplify(0xc00023ccb0)
/usr/local/go/src/regexp/syntax/simplify.go:98 +0x945 fp=0xc0001df150 sp=0xc0001df040 pc=0x562d036194c5
regexp/syntax.(*Regexp).Simplify(0xc00023cd20)
/usr/local/go/src/regexp/syntax/simplify.go:23 +0x4cc fp=0xc0001df260 sp=0xc0001df150 pc=0x562d0361904c
regexp/syntax.(*Regexp).Simplify(0xc00023cb60)
/usr/local/go/src/regexp/syntax/simplify.go:23 +0x4cc fp=0xc0001df370 sp=0xc0001df260 pc=0x562d0361904c
I removed docker completely and installed again. But got the same error.

I tried to reproduce the same issue in my environment and got the below results
I have created the Centos-vm and I tried to install the docker into the Centos
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
When I use the above command I got the appropriate results
In the docker module it self there is no packages available so docker it will show successfully installed but it will not run
I have used the below command to install the docker
sudo yum update check-update
curl -fsSL https://get.docker.com/ | sh
Docker installed successfully
Here is my docker version
I am able to start my docker and the docker status is in active
sudo systemctl start docker
sudo systemctl status docker
NOTE: This error will happen with the old versions also please try to install the latest version of the docker

Related

Install Nodejs v18 on Ubuntu 18.04

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.

Docker unable to locate package (wkhtmltopdf) while building

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

docker service is not enabled - Kubernetes

I'm trying to install Kubernetes on an EC2 instance running Ubuntu 20.04.
I ran the following commands to install Kubeadm and Docker.
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo snap install docker
sudo kubeadm init
When I try to run Kubeadm init in order to initialize my Kubernetes control node, I get the following error:
[init] Using Kubernetes version: v1.23.4
[preflight] Running pre-flight checks
[WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
I subsequently checked to see if Docker was properly installed and pulled an Ubuntu 20.04 docker image and successfully ran it in interactive mode. So, I'm sure that Docker is running.
Does anyone have an idea as to what might be the issue?
My Kubeadm version is:
kubeadm version: &version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:36:57Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}
My Docker version is:
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2
The issue was that I installed docker using snap.
This creates a service name that seems to cause issues with Kubernetes.
Install docker for Ubuntu 20.04 using directions on the official Docker website with apt-get. This seems to work.

How do I install and configure Docker on Ubuntu-like systems (Kubuntu)

i tried using ddev with Linux Kubuntu and did as proceeded as described here:
https://t3terminal.com/typo3-tutorials/install-typo3-docker-ddev/
means:
// Install DDEV
curl -L https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash
// Install mkcert
sudo apt install libnss3-tools
mkcert -install
// Check DDEV works well?
ddev
$ ddev config
… Project name (temp-test): test
… Docroot Location (current directory):
Found a php codebase at ~/github/temp-test.
… Project Type [backdrop, drupal6, drupal7, drupal8, drupal9, laravel, magento, magento2, php, shopware6, typo3, wordpress] (php): laravel
… You may now run 'ddev start'.
~/github/temp-test$ ddev start
Could not connect to docker. Please ensure Docker is installed and running.
So i found this tip's here: Docker can't connect to docker daemon :
~/github/temp-test$ sudo service docker stop && sudo service docker start
Warning: Stopping docker.service, but it can still be activated by:
docker.socket
~/github/temp-test$ ddev start
Could not connect to docker. Please ensure Docker is installed and running.
~/github/temp-test$ sudo service docker start
~/github/temp-test$ ddev start
Could not connect to docker. Please ensure Docker is installed and running.
~/github/temp-test$ sudo service docker restart
~/github/temp-test$
it looks as if docker is installed (because it talks to me Warning: Stopping docker.service) but ddev does not find docker. what else can try?
Docker version
~ docker --version
Docker version 20.10.8, build 3967b7d
Operating System
Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
You need to install docker on Kubuntu to use it.
Details are in the [ddev docs].(https://ddev.readthedocs.io/en/stable/users/docker_installation/#linux-installation-docker-and-docker-compose)
But the bottom line is:
You're using the Ubuntu setup.
Use the instructions for Ubuntu 20.04 assuming you're using something 20.04+: sudo apt-get update && sudo apt-get install docker.io docker-compose
Make sure to do the post-install, which requires you to add your own user to the "docker" group. sudo usermod -aG docker $USER, details in the linked docker instructions

Can't run the docker

I just install the Docker on Ubuntu18.04 by using:
sudo apt update
sudo apt upgrade
sudo apt install docker.io
sudo service docker start
All of the above commands work normally, but when I check the status of the docker servicesudo service docker status, it shows"Docker is not running". I have tried sudo service docker restart, but it doesn't work.
I think you missed the docker-ce package:
sudo apt-get install docker-ce
for more information check the documentation at: install docker ce

Resources