Docker: How to use bash with an Alpine based docker image? Docker: How to use bash with an Alpine based docker image? docker docker

Docker: How to use bash with an Alpine based docker image?


Alpine docker image doesn't have bash installed by default. You will need to add following commands to get bash:

RUN apk update && apk add bash

If youre using Alpine 3.3+ then you can just do

RUN apk add --no-cache bash

to keep docker image size small. (Thanks to comment from @sprkysnrky)


Try using RUN /bin/sh instead of bash.


RUN /bin/sh -c "apk add --no-cache bash"

worked for me.