Ensure Using 'WORKDIR' rather than 'RUN cd' command

RUN cd / does absolutely nothing. WORKDIR / changes the working directory for future commands.
Each RUN command runs in a new shell and a new environment (and technically a new container, though you won't usually notice this). The ENV and WORKDIR directives before it affect how it starts up. If you have a RUN step that just changes directories, that will get lost when the shell exits, and the next step will start in the most recent WORKDIR of the image.

Risk Level: medium
Platform: Docker
Spectral Rule ID: DOCKR040

REMEDIATION

use WORKDIR instead of RUN cd.

FROM nginx
ENV AUTHOR=Docker
- RUN cd /usr/share/nginx/html
+ WORKDIR /usr/share/nginx/html
COPY Hello_docker.html /usr/share/nginx/html
CMD cd /usr/share/nginx/html && sed -e s/Docker/"$AUTHOR"/ Hello_docker.html > index.html ; nginx -g 'daemon off;'

Read more: