8000 DL4005 · hadolint/hadolint Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Miles Dai edited this page Jul 12, 2022 · 3 revisions

Use SHELL to change the default shell

Problematic code:

# Install bash
RUN apk add --update-cache bash=4.3.42-r3

# Use bash as the default shell
RUN ln -sfv /bin/bash /bin/sh

Correct code:

# Install bash
RUN apk add --update-cache bash=4.3.42-r3

# Use bash as the default shell
SHELL ["/bin/bash", "-c"]

Rationale:

Docker provides a SHELL instruction which does not require overwriting /bin/sh in your container.

Clone this wiki locally
0