Yaser Hesham
Yaser Hesham

Reputation: 407

run docker in jenkins container (docker in docker)

Im trying to run docker inside jenkins container, i used this command to create jenkins container

docker run -p 8080:8080 -p 50000:50000 -d -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker jenkins/jenkins:latest

then this command to access jenkins container bash docker exec -u 0 -it <container-id> bash, whenever i run docker i get this error

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)

What is creating this problem and what ways in order to solve it ?

Upvotes: 1

Views: 583

Answers (2)

Yaser Hesham
Yaser Hesham

Reputation: 407

solved by downgrading my server OS to Ubuntu 18

Upvotes: 0

Ceejay
Ceejay

Reputation: 21

This is not reliable anymore, because the Docker Engine is no longer distributed as (almost) static libraries.

so run docker run -p 8080:8080 -p 50000:50000 -d -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins/jenkins:latest

then this command to access jenkins container bash as root user docker exec -u 0 -it <container-id> bash

Once inside the Jenkins container, simply run this command to install docker inside of the Jenkins container: curl https://get.docker.com/ > dockerinstall && chmod 777 dockerinstall && ./dockerinstall this command gets the docker quick installation script and runs the script which then installs docker inside of the container

Exit out of the Jenkins container interactive shell, and run the following command to change permissions on “docker.sock” for added security sudo chmod 666 /var/run/docker.sock

Upvotes: 2

Related Questions