tianon/docker-bash

The latest docker hub image has files [ and [[ in it.

Closed this issue · 1 comments

image
imageID: docker-pullable://bash@sha256:293ac2e5c5be7722d6f4aa620c6451aea359eec1f2f6d5c0faef948b86e449cd

See the very relevant second half of the answer in tianon/docker-brew-ubuntu-core#156 (comment) -- [ and [[ are shell utilities, and in this case the ones we have in /usr/bin come directly from our Alpine base image and if you check what they're symlinks to you'll see they're part of busybox:

$ docker run -it --rm alpine:3.10
/ # help
Built-in commands:
------------------
	. : [ [[ alias bg break cd chdir command continue echo eval exec
	exit export false fg getopts hash help history jobs kill let
	local printf pwd read readonly return set shift source test times
	trap true type ulimit umask unalias unset wait

In a POSIX shell, [ is typically an alias for the test built-in utility, and [[ is typically a Bashism, but it's one that Busybox supports to a certain extent.

If you use either of [ or [[ from Bash, it will not invoke these versions from /usr/bin but will instead invoke its own built-in implementations of their functionality.