no-shell-symlink
What it does
Section titled “What it does”Reports a RUN that replaces /bin/sh. That is an ln command with /bin/sh among its arguments (ln -sf /bin/bash /bin/sh).
Why it matters
Section titled “Why it matters”Replacing /bin/sh changes the shell that every script of the image, and of the packages you install, expects to be a POSIX sh. Scripts that start with #!/bin/sh then run under another shell than the one they were written for, and package scripts can fail in odd ways.
To use another shell for the build, the SHELL instruction (SHELL ["/bin/bash", "-c"]) changes only the shell of the later RUN instructions.
Example
Section titled “Example”...RUN wget -q https://example.com/fRUN ln -sf /bin/bash /bin/shRUN echo sudo cd ps... sudo make install...Configuration
Section titled “Configuration”dockerfile: lint: rules: no-shell-symlink: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line no-shell-symlink in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| hadolint | DL4005 |
full |