-
Maintained by:
Tianon (of the Docker Community), with Chet's support (from Bash upstream) -
Where to get help:
the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow
devel-20221107
,devel
,devel-20221107-alpine3.16
,devel-alpine3.16
5.2.9
,5.2
,5
,latest
,5.2.9-alpine3.16
,5.2-alpine3.16
,5-alpine3.16
,alpine3.16
5.1.16
,5.1
,5.1.16-alpine3.16
,5.1-alpine3.16
5.0.18
,5.0
,5.0.18-alpine3.16
,5.0-alpine3.16
4.4.23
,4.4
,4
,4.4.23-alpine3.16
,4.4-alpine3.16
,4-alpine3.16
4.3.48
,4.3
,4.3.48-alpine3.16
,4.3-alpine3.16
4.2.53
,4.2
,4.2.53-alpine3.16
,4.2-alpine3.16
4.1.17
,4.1
,4.1.17-alpine3.16
,4.1-alpine3.16
4.0.44
,4.0
,4.0.44-alpine3.16
,4.0-alpine3.16
3.2.57
,3.2
,3
,3.2.57-alpine3.16
,3.2-alpine3.16
,3-alpine3.16
3.1.23
,3.1
,3.1.23-alpine3.16
,3.1-alpine3.16
3.0.22
,3.0
,3.0.22-alpine3.16
,3.0-alpine3.16
-
Where to file issues:
https://github.com/tianon/docker-bash/issues -
Supported architectures: (more info)
amd64
,arm32v6
,arm32v7
,arm64v8
,i386
,ppc64le
,s390x
-
Published image artifact details:
repo-info repo'srepos/bash/
directory (history)
(image metadata, transfer size, etc) -
Image updates:
official-images repo'slibrary/bash
label
official-images repo'slibrary/bash
file (history) -
Source of this description:
docs repo'sbash/
directory (history)
Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features.
The primary use cases this image is targeting are testing new features of more recent Bash versions before your primary distribution updates packages and testing shell scripts against different Bash versions to ensure compatibility. There are likely other interesting use cases as well, but those are the primary two the image was initially created to solve!
There are a few main things that are important to note regarding this image:
-
Bash itself is installed at
/usr/local/bin/bash
, not/bin/bash
, so the recommended shebang is#!/usr/bin/env bash
, not#!/bin/bash
(or explicitly running your script viabash /.../script.sh
instead of letting the shebang invoke Bash automatically). The image does not include/bin/bash
, but if it is installed via the package manager included in the image, that package will install to/bin/bash
and might cause confusion (although/usr/local/bin
is ahead of/bin
in$PATH
, so as long as plainbash
or/usr/bin/env
are used consistently, the image-provided Bash will be preferred). -
Bash is the only thing included, so if your scripts rely on external tools (such as
jq
, for example), those will need to be added manually (viaapk add --no-cache jq
, for example).
$ docker run -it --rm bash:4.4
bash-4.4# which bash
/usr/local/bin/bash
bash-4.4# echo $BASH_VERSION
4.4.0(1)-release
$ docker run -it --rm -v /path/to/script.sh:/script.sh:ro bash:4.4 bash /script.sh
...
$ docker run -it --rm -v /path/to/script.sh:/script.sh:ro bash:3.2 bash /script.sh
...
FROM bash:4.4
COPY script.sh /
CMD ["bash", "/script.sh"]
Then, build and run the Docker image:
$ docker build -t my-bash-app .
...
$ docker run -it --rm --name my-running-app my-bash-app
...