Install Bash on Alpine Linux - Docker

The Alpine Linux Image is ~5MB in size, so it will not contain most of the non-essential packages. To have the size limited you will not get the bash shell either, if you try to run a bash script or command, you will get an error: sh: bash: not found

# bash
sh: bash: not found

Install bash on Alpine Linux using apk

Install Bash on Alpine Linux Command
# apk add bash

(1/1) Installing bash (5.1.16-r2)
Executing busybox-1.35.0-r17.trigger
OK: 58 MiB in 28 packages

Install bash on Dockerfile with Alpine Linux base Image

FROM alpine:latest
RUN apk add bash
CMD bash

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap