MF05-PRA05-JoseGarrido-JenkinsPipeline #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PRA05
Tasks
Execution
Primero: descargar de hub.docker.com jenkins
creado script
create-run-jenkins.sh
abrir el navegador en esta ulr de login e introducir el password obtenido con la instrucción anterior.
Ya desde la web de administración de Jenkins:
Con autoinstalador desde url y en el directorio JDKx
jdk8u292-b10
jdk-11.0.2
jdk-17.0.2
jdk-21.0.2
Probada app Vaadin para hacer las pruebas de pipeline
su github. Se utilizará la branch
docker-version
groovy con mi pipeline
Creando la imagen docker con el compilado
Añado en el directorio raíz del proyecto java el fichero
Dockerfile
instalación de docker en el container de jenkins
con el container de jenkins ejecutándose conectarse a su
bash
como rooty dentro de instalar docker con
y comprobar que los permisos del socket de docker son los correctos
debe devolver
si el socket no tiene estos permisos cambiarlos con:
Extra: export & import docker container
Siguiendo las instrucciones de este artículo he conseguido exportar e importar el contenido de un contenedor docker.
Paso 0: instalar
docker-volumes.sh
github de
docker-volumes.sh
https://raw.githubusercontent.com/ricardobranco777/docker-volumes.sh/master/docker-volumes.sh
Paso 1: exportar docker contaniner
mi container se llama
jenkins
docker image se llamará
jenkins-image
y se guardará enjenkins.tar
el volumen (jenkins_home) se guarda en el fichero
jenkins-volume.tar
Paso 2. Importar la imagen sin importar el volumen
Log in to your remote host, then run the following command to load it to your remote machine’s Docker daemon:
se crea la imagen
jenkins-image
pero la vamos a renombrar a
pra05/jenkins-image
Use docker create to reinitialize your Docker container image with its original run flags from your source machine. For instance, my Nginx Docker container originally had port 80 mapped to my host machine’s port 8080:
Run your newly imported Docker container:
Confirm that your imported image is working properly by listing all the active containers in the system:
Paso 3. Importar la imagen importando el volumen
Create a new Docker container using your exported image file:
Run the docker-volume.sh script with your original .tar file to load it to your new system’s Docker daemon:
Start your new Docker container by running the following command:
Test if your container is loading your volume properly by looking at its internal config data:
Screenshots
configuración maven3
configuración jdk8
configuración jdk11
configuración jdk17
configuración jdk21
configuración maven-integration
configuración docker-plugins
configuración ssh-plugins
configuración sonnar-qube-plugin
pipeline sin docker
pipeline con docker y dockerhub
pipeline con docker y dockerhub
probando la imagen de docker: login y pull
probando la imagen de docker: running
probando la imagen de docker: funciona!