mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-06 06:46:26 +01:00
50 lines
1.1 KiB
Plaintext
50 lines
1.1 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * applications/deployments/managing-deployment-processes.adoc
|
|
|
|
[id="deployments-exe-cmd-in-container_{context}"]
|
|
= Executing commands inside a container
|
|
|
|
You can add a command to a container, which modifies the container's startup
|
|
behavior by overruling the image's `ENTRYPOINT`. This is different from a
|
|
lifecycle hook, which instead can be run once per deployment at a specified
|
|
time.
|
|
|
|
.Procedure
|
|
|
|
. Add the `command` parameters to the `spec` field of the DeploymentConfig. You
|
|
can also add an `args` field, which modifies the `command` (or the `ENTRYPOINT`
|
|
if `command` does not exist).
|
|
+
|
|
[source,yaml]
|
|
----
|
|
spec:
|
|
containers:
|
|
-
|
|
name: <container_name>
|
|
image: 'image'
|
|
command:
|
|
- '<command>'
|
|
args:
|
|
- '<argument_1>'
|
|
- '<argument_2>'
|
|
- '<argument_3>'
|
|
----
|
|
+
|
|
For example, to execute the `java` command with the `-jar` and
|
|
`/opt/app-root/springboots2idemo.jar` arguments:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
spec:
|
|
containers:
|
|
-
|
|
name: example-spring-boot
|
|
image: 'image'
|
|
command:
|
|
- java
|
|
args:
|
|
- '-jar'
|
|
- /opt/app-root/springboots2idemo.jar
|
|
----
|