You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### 2. Create the following volumes to share the Docker client TLS certificates needed to connect to the Docker daemon and persist the Jenkins data
9
+
### 2. Create the following volumes to share the Docker client TLS certificates needed to connect to the Docker daemon and persist the Jenkins data
10
10
11
11
```bash
12
-
$ docker volume create jenkins-docker-certs
13
-
$ docker volume create jenkins-data
12
+
$ docker volume create jenkins-docker-certs
13
+
$ docker volume create jenkins-data
14
14
```
15
15
16
16
### 3. In order to execute Docker commands inside Jenkins nodes, download and run the docker:dind Docker image
@@ -22,11 +22,11 @@ docker container run \
22
22
--detach \
23
23
--privileged \
24
24
--network jenkins \
25
-
--ntework-alias docker \
25
+
--network-alias docker \
26
26
--env DOCKER_TLS_CERTDIR=/certs \
27
27
--volume jenkins-docker-certs:/certs/client \
28
28
--volume jenkins-data:/var/jenkins_home \
29
-
--publish 2376:2376
29
+
--publish 2376:2376 \
30
30
docker:dind
31
31
```
32
32
@@ -39,37 +39,26 @@ docker container run \
39
39
--detach \ # 3
40
40
--privileged \ # 4
41
41
--network jenkins \ # 5
42
-
--ntework-alias docker \ # 6
42
+
--network-alias docker \ # 6
43
43
--env DOCKER_TLS_CERTDIR=/certs \ # 7
44
44
--volume jenkins-docker-certs:/certs/client \ # 8
45
45
--volume jenkins-data:/var/jenkins_home \ # 9
46
-
--publish 2376:2376 # 10
46
+
--publish 2376:2376 \ # 10
47
47
docker:dind # 11
48
48
```
49
49
50
-
1. The Docker conatiner name
51
-
2. Removes the Docker conatiner instance when it is shut down.
50
+
1. The Docker container name.
51
+
2. Removes the Docker container instance when it is shut down.
52
52
3. Runs the Docker container in the background.
53
-
4. Running Docker in Docker currently requires provileged access to function properly.
54
-
5. Join to previous created network
53
+
4. Running Docker in Docker currently requires privileged access to function properly.
54
+
5. Join to previous created network.
55
55
6. Makes the Docker in Docker container available as the hostname _docker_ within the _jenkins_ network.
56
56
7. Enables the use of TLS in the Docker server. Due to the use of a privileged container, this is recommended, though it requires the use of the shared volume described below. This environment variable controls the root directory where Docker TLS certificates are managed.
57
57
8. Maps the _/certs/client_ directory inside the container to a Docker volume named _jenkins-docker-certs_ as created above.
58
-
9. Maps the */var/jenkins_home* directory inside the container to the Docker volume named _jenkins-data_ as created above. This will allow for other Docker containers controlled by this Docker container’s Docker daemon to mount data from Jenkins.
58
+
9. Maps the _/var/jenkins_home_ directory inside the container to the Docker volume named _jenkins-data_ as created above. This will allow for other Docker containers controlled by this Docker container's Docker daemon to mount data from Jenkins.
59
59
10. Exposes the Docker daemon port on the host machine. This is useful for executing _docker_ commands on the host machine to control this inner Docker daemon.
60
60
11. The _docker:dind_ image itself.
61
61
62
-
* Annotation free version
63
-
64
-
```bash
65
-
docker container run --name jenkins-docker --rm --detach \
1. Specifies the Docker container name for this instance of the _jenkinsci/blueocean_ Docker image.
98
+
1. Specifies the Docker container name for this instance of the _jenkinsci/blueocean_ Docker image.
110
99
111
-
2. Removes the Docker conatiner instance when it is shut down.
100
+
2. Removes the Docker container instance when it is shut down.
112
101
113
102
3. Runs the Docker container in the background.
114
103
115
104
4. Connects this container to the jenkins network defined in the earlier step. This makes the Docker daemon from the previous step available to this Jenkins container through the hostname docker.
116
105
117
106
5. Specifies the environment variables used by `docker`, `docker-compose`, and other Docker tools to connect to the Docker daemon from the previous step.
118
107
119
-
6. Maps (i.e. "publishes") port 8080 of the _jenkinsci/blueocean_ container to port 8080 on the host machine. The first number represents the port on the host while the last represents the container’s port. Therefore, if you specified _-p 49000:8080_ for this option, you would be accessing Jenkins on your host machine through port 49000.
108
+
6. Maps (i.e. "publishes") port 8080 of the _jenkinsci/blueocean_ container to port 8080 on the host machine. The first number represents the port on the host while the last represents the container's port. Therefore, if you specified _-p 49000:8080_ for this option, you would be accessing Jenkins on your host machine through port 49000.
120
109
121
110
7. Maps port 50000 of the jenkinsci/blueocean container to port 50000 on the host machine. This is only necessary if you have set up one or more inbound Jenkins agents on other machines, which in turn interact with the _jenkinsci/blueocean_ container (the Jenkins "controller"). Inbound Jenkins agents communicate with the Jenkins controller through TCP port 50000 by default. You can change this port number on your Jenkins controller through the Configure Global Security page. If you were to change the TCP port for inbound Jenkins agents of your Jenkins controller to 51000 (for example), then you would need to re-run Jenkins (via this docker run … command) and specify this "publish" option with something like _--publish 52000:51000_, where the last value matches this changed value on the Jenkins controller and the first value is the port number on the machine hosting the Jenkins controller. Inbound Jenkins agents communicate with the Jenkins controller on that port (52000 in this example). Note that WebSocket agents in Jenkins 2.217 do not need this configuration.
122
111
123
-
8. Maps the */var/jenkins_home* directory in the container to the Docker volume with the name _jenkins-data_. Instead of mapping the */var/jenkins_home* directory to a Docker volume, you could also map this directory to one on your machine’s local file system. For example, specifying the option
124
-
*--volume $HOME/jenkins:/var/jenkins_home* would map the container’s */var/jenkins_home* directory to the jenkins subdirectory within the *$HOME* directory on your local machine, which would typically be */Users/<your-username>/jenkins* or */home/<your-username>/jenkins*. Note that if you change the source volume or directory for this, the volume from the _docker:dind_ container above needs to be updated to match this.
112
+
8. Maps the _/var/jenkins_home_ directory in the container to the Docker volume with the name _jenkins-data_. Instead of mapping the _/var/jenkins_home_ directory to a Docker volume, you could also map this directory to one on your machine's local file system. For example, specifying the option
113
+
_--volume $HOME/jenkins:/var/jenkins_home_ would map the container's _/var/jenkins_home_ directory to the jenkins subdirectory within the _$HOME_ directory on your local machine, which would typically be _/Users/<your-username>/jenkins_ or _/home/<your-username>/jenkins_. Note that if you change the source volume or directory for this, the volume from the _docker:dind_ container above needs to be updated to match this.
125
114
126
-
9. Maps the _/certs/client_ directory to the previously created _jenkins-docker-certs_ volume. This makes the client TLS certificates needed to connect to the Docker daemon available in the path specified by the *DOCKER_CERT_PATH* environment variable.
115
+
9. Maps the _/certs/client_ directory to the previously created _jenkins-docker-certs_ volume. This makes the client TLS certificates needed to connect to the Docker daemon available in the path specified by the _DOCKER_CERT_PATH_ environment variable.
127
116
128
117
10. The _jenkinsci/blueocean_ Docker image itself.
129
118
130
-
* Annotation-free version
131
-
132
-
```bash
133
-
docker container run --name jenkins-blueocean --rm --detach \
To unlock Jenkins we have to paste a password, we can find the password inside the running container, run the following command `cat /var/jenkins_home/secrets/initialAdminPassword` to obtain the initial password
echo "Deploying release ${RELEASE} to environment ${TARGET_ENVIRONMENT}"
114
+
}
115
115
```
116
116
117
-
Este paso solicitará una entrada del usuario. Notar que en el siguiente `stage`, podemos acceder a *TARGET_ENVIRONMENT*. Si seleccionamos _abort_ los pasos siguientes no se realizarán.
117
+
Este paso solicitará una entrada del usuario. Notar que en el siguiente `stage`, podemos acceder a _TARGET_ENVIRONMENT_. Si seleccionamos _abort_ los pasos siguientes no se realizarán.
118
118
119
119
```
120
120
post {
@@ -133,7 +133,7 @@ En el comando _post_ podemos tener diferentes condiciones aquí estamos usando _
133
133
134
134
## 1.3 Parallel stages
135
135
136
-
* Crear un nuevo Jenkinsfile en `demo1/1.3/Jenkinsfile`
136
+
- Crear un nuevo Jenkinsfile en `demo1/1.3/Jenkinsfile`
137
137
138
138
```groovy
139
139
pipeline {
@@ -217,8 +217,8 @@ parallel {
217
217
}
218
218
```
219
219
220
-
Con _parallel_ podemos ejecutar mútiples`stages` en paralelo.
220
+
Con _parallel_ podemos ejecutar múltiples`stages` en paralelo.
0 commit comments