Installing jenkins https://www.jenkins.io/doc/book/installing/docker/ I am following this docs for installing jenkins on docker :)
-
Create the bridge network for jenkins
docker network bridge jenkins
This network name jenkins will be used.
-
Pull the docker bind image, used for executing Docker commands inside Jenkins nodes
docker image pull docker:dind
-
Run below command for for executing the docker commands
docker run --name jenkins-docker --rm -d --privileged --network jenkins --network-alias docker --env DOCKER_TLS_CERTDIR=/certs --volume jenkins-docker-certs:/certs/client --volume jenkins-data:/var/jenkins_home --publish 2376:2376 docker:dind --storage-driver overlay2
- Make sure to have the Dockerfile file copied
- Building the image
docker build -t mylocaljenkins-blueocean:0.0.0.1 .
- Now time for running the image
docker run --name jenkins-blueocean --restart=on-failure --detach --network jenkins --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 --publish 8080:8080 --publish 50000:50000 --volume jenkins-data:/var/jenkins_home --volume jenkins-docker-certs:/certs/client:ro mylocaljenkins-blueocean:0.0.0.1
Change the mod to
chmod +x init_jenkins.sh
and run
./init_jenkins.sh
Make sure your port 8080 is available :