Ensure 'RUN' shell command has pipefail flag
The pipefail flag -o
causes the pipeline to return the exit status of the last (rightmost) command to exit with a non-zero status. It returns zero if all commands in the pipeline exit successfully. Because this option is disabled by default, you should set it to make sure the commands will failed if some problem in the pipe.
Risk Level: medium
Platform: Docker
Spectral Rule ID: DOCKR051
REMEDIATION
Add the pipefail flag -o`` to the
RUN` shell command
FROM ubuntu:22.10
+ RUN /bin/bash -o pipefail
RUN /bin/bash ./my-awesome-script-1 | ./my-awesome-script-2
Read more:
Updated over 1 year ago