Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2b2ea1

Browse files
committed
CF-5236: support CMD with entrypoint
1 parentd097588 commitb2b2ea1

File tree

1 file changed

+60
-7
lines changed

1 file changed

+60
-7
lines changed

‎_docs/codefresh-yaml/steps/freestyle.md‎

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ step_name:
2525
commands:
2626
- bash-command1
2727
- bash-command2
28+
cmd:
29+
- arg1
30+
- arg2
2831
environment:
2932
- key=value
33+
entry_point:
34+
- cmd
35+
- arg1
3036
fail_fast: false
3137
when:
3238
branch:
@@ -49,17 +55,64 @@ step_name:
4955
|`description`| A basic, free-text description of the step.| Optional|
5056
|`image`| The image from which the executable container is created. It can be an explicit ID of a Docker image, or a variable that references a**Build** or**Push** step.| Required|
5157
|`working_directory`| The directory from which the commands are executed. It can be an explicit path in the container's file system, or a variable that references another step. The default`working_directory` is the cloned repository directory and not the working directory specified by the image. If you need to use the default working directory of the image use`IMAGE_WORK_DIR`.| Default|
52-
|`commands`| One or more bash commands to execute.| Optional|
58+
|`commands`| One or more commands to execute in a shell in the container, as array of strings.| Optional|
59+
|`cmd`| docker CMD arguments to use along with the container entrypoint. can be string or array of strings.| Optional|
60+
|`entry_point`| override the default container entrypoint. can be string or array of strings.| Optional|
5361
|`environment`| A set of environment variables for the container.| Optional|
5462
|`fail_fast`| If a step fails, and the process is halted. The default value is`true`.| Default|
5563
|`when`| Define a set of conditions that need to be satisfied in order to execute this step. You can find more information in the[Conditional Execution of Steps]({{ site.baseurl }}/docs/codefresh-yaml/conditional-execution-of-steps/) article.| Optional|
5664
|`on_success`,`on_fail` and`on_finish`| Define operations to perform upon step completion using a set of predefined[Post-Step Operations]({{ site.baseurl }}/docs/codefresh-yaml/post-step-operations/).| Optional|
5765

58-
<divclass="bd-callout bd-callout-warning"markdown="1">
59-
#####ENTRYPOINT
60-
61-
if you want to perform the entrypoint command that was described in the Dockerfile of the Docker image that you use in this step, you need to add this entrypoint command to list of commands of the freestyle step
62-
</div>
63-
6466
**Exported resources:**
6567
- Working Directory.
68+
69+
##Entry point
70+
71+
When using the original container entrypoint, you can use the`cmd` field to specify additional agruments to be used with the entrypoint. This can be a string, or an array of strings. For example:
72+
73+
```yaml
74+
image:mwendler/cowsay
75+
cmd:
76+
-"Hello"
77+
```
78+
79+
is equivalent to running`docker run mwendler/cowsay Hello` which is equivalent to running `cowsay Hello` inside the container.
80+
81+
82+
You can override the container's default entrypoint using the `entry_point` field. This can be a string, or an array of strings. For example:
83+
84+
```yaml
85+
86+
image: mwendler/cowsay
87+
entry_point:
88+
- echo
89+
- Hello
90+
```
91+
92+
## Commands
93+
94+
When you use the `commands` field, it will override the container original `entrypoint` and will execute the commands in a shell inside the container.
95+
The provided commands are concatenated into a single command using the shell's `;` operator, and are run using the default shell `/bin/sh` as an entry point.
96+
Additional settings that are set only when using commands are `set -e`, and the `cf_export` utility.
97+
98+
### Commands and Entry point
99+
100+
If you want to retain the original entrypoint, do not use the `commands` field.
101+
102+
However, this example:
103+
104+
```yaml
105+
image: mwendler/cowsay
106+
commands:
107+
- "Hello"
108+
```
109+
110+
will cause and error because the engine will attempt to run the command `Hello` in a shell inside the container, and the command `Hello` is not a valid command.
111+
In order to use the `commands` form with an `entrypoint` enabled container, you can add the commands from the entrypoint to the list of commands, like so:
112+
113+
```yaml
114+
image: mwendler/cowsay
115+
commands:
116+
- cowsay "Hello"
117+
```
118+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp