简体   繁体   中英

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?

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

solved by downgrading my server OS to Ubuntu 18

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM