Skip to content
John Backus edited this page Sep 6, 2016 · 2 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.

You can’t perform that action at this time.