I am trying to configure Jenkins as docker container with docker-in-docker on an EC2 instance running Ubuntu 22.04 but I am getting `GLIBC_2.32′ and ‘GLIBC_2.34’ not found when I try to run a script containing docker command using docker plugin in Jenkins. I have followed this as reference for setting Jenkins on my localhost. When moved to remote, I get these errors
...
$ docker login -u username -p ******** https://registry.gitlab.com
docker: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by docker)
docker: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by docker)
...
Here is the docker-compose.yaml file
version: '3.3'
services:
docker-in-docker-container:
image: docker:dind
container_name: docker-in-docker-container
user: root
privileged: true
expose:
- 2375
volumes:
- ./data:/var/jenkins_home
environment:
DOCKER_TLS_CERTDIR: ""
restart: on-failure
jenkins-container:
image: jenkins/jenkins:lts-jdk17
container_name: jenkins-container
user: root
depends_on:
- docker-in-docker-container
ports:
- '8080:8080'
privileged: true
volumes:
- ./data:/var/jenkins_home
- /usr/bin/docker:/usr/bin/docker
environment:
DOCKER_HOST: tcp://docker-in-docker-container:2375
restart: on-failure
I tried to use various images from the Jenkins docker repository like alpine, jdk8, jdk11, and jdk17, but no luck.
Here is ldd info for troubleshooting from host machine
ubuntu@ip-10-0-0-251:~$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
Here is ldd info for Jenkins container
root@a2da70fc6100:/# ldd --version
ldd (Debian GLIBC 2.31-13+deb11u3) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
Looking forward to any help! Thanks.
3
Answers
As you’re suspecting, you’ve having shared-library issues because you’re injecting a
docker
binary that depends on a different version of GNU libc than exists in the image.Injecting a
docker
binary like this isn’t especially reliable due to issues like this. In theory you could work around it by building a custom image that installed the required versions of the shared libraries, but if you’re doing that, it’s easier and safer to install thedocker
CLI tool in the image. (Running the Docker daemon has complex requirements, but the CLI tool itself doesn’t depend on anything other than access to a Docker socket.) Also see the "Installing more tools" section in the Jenkins image documentation.You do not need
EXPOSE
,CMD
, or other setup; that all comes from the base image.In the Compose file, add a
build:
line to build this custom image, delete theimage:
line, and delete thevolumes:
mounting the host’s/usr/bin/docker
.Try UBUNTU 18.04LTS IT WILL WORK
Same error I got in Ubuntu 22.04lts on my Ec2 instance where I am trying to integrate docker to Jenkins container using docker runtime docker.sock by following command
It will allow docker runtime to integrate with jenkins
Tried docker pull
It threw me the same error
Getting
'GLIBC_2.32'
and'GLIBC_2.34'
not found in Jenkins ( required by Docker)The reason is Ec2 instance of
Ubuntu 22.04lts has GLIBC 2.35
check this command in ece instance
ldd –version
But inside instance jenkins container has GLIBC 2.31
CHECK
ldd –version
GLIBC 2.31
SO BECAUSE OF THIS DOCKER won’t work inside that jenkins container in Ubuntu 22.04lts
Then I TRIED IN Ubuntu 18.04 LTS
Use the same steps again
Now check docker pull…
It worked perfectly
use this dockerfile to install docker and dependencies