This gist is based off of the Jenkins Docker setup
- Create a bridge network in Docker.
docker network create jenkins
- Create volumes to share the Docker client TLS certificates needed to connect to the Docker deamon and persist the Jenkins data
docker volume create jenkins-docker-certs && docker volume create jenkins-data
-
In order to execute Docker commands inside Jenkins nodes, download and run the docker:dind Docker image
Option A. Run below command, to delete container automatically once stopped for any reason. Prefer this if you want containers to tidy up after themselves
docker container run --name jenkins-docker --rm --detach --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
Option B. Run this command to always restart container once stopped. Prefer this option if you want this long term
docker container run --name jenkins-docker --restart always --detach --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
-
Now, download the jenkinsci/blueocean image and run it as a container in Docker.
Option A. Run below command, to delete the container automatically once stopped for any reason. Prefer this if you want containers to tidy up after themselves
docker container run --name jenkins-blueocean --rm --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 jenks-docker-certs:/certs/client:ro jenkinsci/blueocean
Option B. Run this command to always restart container once stopped. Prefer this option if you want this long term
docker container run --name jenkins-blueocean --restart always --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 jenks-docker-certs:/certs/client:ro jenkinsci/blueocean
-
Navigate to localhost:8080 from your browser and you should see a similar screen as below.
-
Now get the password by running the below command. Copy and paste in Administrator password text box from above screen
docker container logs jenkins-blueocean
-
No click on Continue
-
Since we are doing a basic setup, click Install suggested plugins. Once clicked you should see below screen
-
On the next screen, create an Admin User
-
Follow rest of default installation pages.
-
Once completed you should see your newly created Jenkins Dashboard
I am getting this error:
Client sent an HTTP request to an HTTPS server.
when trying to run the test connection with docker on macOS. Do you have any idea what might be ?