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
Copy file name to clipboardExpand all lines: modules/nodes-containers-init-creating.adoc
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
// * nodes/nodes-containers-init.adoc
4
4
5
5
[id="nodes-containers-init-creating_{context}"]
6
-
= Creating Init Containers
6
+
= Creating Init Containers
7
7
8
8
The following example outlines a simple Pod which has two Init Containers. The first waits for `myservice` and the second waits for `mydb`. After both containers complete, the pod begins.
9
9
@@ -22,15 +22,15 @@ metadata:
22
22
spec:
23
23
containers:
24
24
- name: myapp-container
25
-
image: busybox
25
+
image: registry.access.redhat.com/ubi8/ubi:latest
26
26
command: ['sh', '-c', 'echo The app is running! && sleep 3600']
27
27
initContainers:
28
28
- name: init-myservice
29
-
image: busybox
30
-
command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
29
+
image: registry.access.redhat.com/ubi8/ubi:latest
30
+
command: ['sh', '-c', 'until getent hosts myservice; do echo waiting for myservice; sleep 2; done;']
31
31
- name: init-mydb
32
-
image: busybox
33
-
command: ['sh', '-c', 'until nslookup mydb; do echo waiting for mydb; sleep 2; done;']
32
+
image: registry.access.redhat.com/ubi8/ubi:latest
33
+
command: ['sh', '-c', 'until getent hosts mydb; do echo waiting for mydb; sleep 2; done;']
34
34
----
35
35
36
36
. Create a YAML file for the `myservice` service.
@@ -66,7 +66,7 @@ spec:
66
66
. Run the following command to create the `myapp-pod`:
67
67
+
68
68
[source,terminal]
69
-
----
69
+
----
70
70
$ oc create -f myapp.yaml
71
71
----
72
72
+
@@ -90,7 +90,7 @@ NAME READY STATUS RESTARTS AGE
90
90
myapp-pod 0/1 Init:0/2 0 5s
91
91
----
92
92
+
93
-
Note that the pod status indicates it is waiting
93
+
Note that the pod status indicates it is waiting
94
94
95
95
. Run the following commands to create the services:
0 commit comments