Skip to content

Commit

Permalink
Update rules/S7019/docker/rule.adoc
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas Wielage <jonas.wielage@sonarsource.com>
  • Loading branch information
1 parent 8f00905 commit dd2372c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rules/S7019/docker/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ This can cause problems when trying to gracefully stop containers because the ma
Moreover, the exec form provides more control and predictability over the execution of the command.
It does not invoke a command shell, which means it does not have the potential side effects of shell processing.

Although, the exec form does not allow shell features such as variable expansion, piping (`|`) and command chaining (`&&`, `||`, `;`).
In case you need to use these features, there is few alternatives:
- create a wrapper script
- explicitly specify the shell with the `SHELL` instruction before the `CMD` or `ENTRYPOINT` instruction

=== Exceptions

As mentioned above, this rule will not raise an issue if the `SHELL` instruction is used before the `CMD` or `ENTRYPOINT` instruction, as we consider this is a conscious decision.
The exec form does not allow shell features such as variable expansion, piping (`|`) and command chaining (`&&`, `||`, `;`).
In case you need to use these features, there are a few alternatives:
* Creation of a wrapper script
* Explicitly specify the shell to use with the `SHELL` instruction before `CMD` or `ENTRYPOINT`


This rule will not raise an issue if the `SHELL` instruction is used before the `CMD` or `ENTRYPOINT` instruction, as we consider this a conscious decision.

== How to fix it

Expand Down

0 comments on commit dd2372c

Please sign in to comment.