Docker Community Forums

Share and learn in the Docker community.

[ -x /usr/bin/bash ] not working

In some conditions, [ -x /usr/bin/bash ] not working.

$docker run -it --rm ubuntu:21.04
root@ee6da3868a24:/# ls -al /usr/bin/bash
-rwxr-xr-x 1 root root 1404744 Mar 19 16:02 /usr/bin/bash
root@ee6da3868a24:/# [ -x /usr/bin/bash ] && echo yes
root@ee6da3868a24:/#

working condition:
$docker run -it --rm ubuntu:20.04
root@142639326b8a:/# ls -al /usr/bin/bash
-rwxr-xr-x 1 root root 1183448 Jun 18 2020 /usr/bin/bash
root@142639326b8a:/# [ -x /usr/bin/bash ] && echo yes
yes
root@ee6da3868a24:/#

Here are all the conditions I tested and its’result:

| Host OS | Docker version | dockerimage:ubuntu:21.04 | dockerimage:ubuntu:20.04 | 
| ubuntu 18.04.5 LTS | 19.03.14 | not working | working |
| ubuntu 18.04.4 LTS  | 19.03.9 | not working | working |
| ubuntu 18.04.5 LTS  | 20.10.2 | working  | working |

Anyone know what maybe the problem? Thanks.
I hope to make dockerimage:ubuntu:21.04 also working on the two not working conditions.