Closed Juju075 closed 1 year ago
try this docker run --rm -u root -p 8080:8080 -v jenkins-data:/var/jenkins_home -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v "$HOME":/home jenkinsci/blueocean
Apache conf *:80 not dynamic need to be set before -u root docker run -u root nom_de_l_image
problem come from plugin Docker pipeline
ok - agent { docker { image 'node:16.13.1-alpine' } }
node configuration launch docker container to resolve build need to be configured.
use this image alpine:latest
ok - node.js (official) alpine(lighter & latest)
node:18.16-alpine https://hub.docker.com/layers/library/node/18.16-alpine/images/sha256-44aaf1ccc80eaed6572a0f2ef7d6b5a2982d54481e4255480041ac92221e2f11?context=explore
Not found in DockerHub (jenkins)
Find a alpinelinux/dockercli 1M downloaded - not working on pipeline
This will be the one but can't image from docker hub
pipeline {
agent {
docker { image 'node:18.16-alpine' }
}
configure docker as agent and locate repectory
ok -Not explained in jenkins documentation Setup Docker Containers as Build Agents for Jenkins
remote api
4243:32768
32768 to 60999 is used by Docker to assign a host port for Jenkins to connect to the container https://docs.docker.com/engine/install/
1- Docker Host
Ports: | ok Docker Remote API port 4243 Docker Hostport Range 32768 to 60999
Networks test (ping) connect: api;
mount volumes and persist data 1- var/www 2- log/apache2 3- apache2/sites-availe/ 4- database 5- jenkins home 6- jenkins 7 - /lib/systemd/system/httpd.service
httpd.service | ok update ExecStart to ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock
Reload and restart docker service.
2- Create a Jenkins Agent Docker Image
test
Container isolé. Pour que Jenkins puisse executer les shells docker .
Non chaque conteneur sont gerer par une version light de docker. pour executer les shell utiliser le socket de docker (daemon) monte un volume du socket dans le conteneur
Socket d'ecoute daemon Docker mount volume on jenkins
/var/run/docker.sock:/var/run/docker.sock