Overview
- OS Ubuntu 18.04
- Docker needs to be installed on the system
Run Jenkins as docker container:
- Install docker on the system:
sudo apt install -y docker.io
- Add your current user to the docker group:
sudo usermod -aG docker [username]
- Exit and log back into the server and check the current user's groups:
groups
- Create Jenkins docker network:
docker network create jenkins
- Create docker volume for Jenkins certs:
docker volume create jenkins-docker-certs
- Create docker volume for Jenkins data:
docker volume create jenkins-data
- Run docker container that manages certs:
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
- Run docker container with Blue Ocean plugin:
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 \ --volume jenkins-data:/var/jenkins_home \ --volume jenkins-docker-certs:/certs/client:ro \ --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean
- Check if containers are up and running:
docker ps
- Verify that Jenkins dashboard is up and running. Go to the URL address of the Jenkins server
[jenkins_server_url]:8080
: - To unlock the Jenkins, get the password from UI (Blue Ocean) container:
docker logs jenkins-blueocean