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 bash-5.1.16-r2.post-install
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


Have Questions? Post them here!
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.