$ cat docker-compose.yml
services:
test:
command: /bin/readlink /bin
image: bash
volumes:
- /usr/bin/readlink:/bin/readlink
$ docker-compose run --rm test
Creating tmputpywvkia7_test_run ... done
/usr/local/bin/docker-entrypoint.sh: line 11: /bin/readlink: No such file or directory
ERROR: 127
mmmmmhhhhhhhhh…
Let’s do some in-depth analysis
$ ls -l /usr/bin/readlink
-rwxr-xr-x 1 root root 39328 feb 7 2022 /usr/bin/readlink
$ docker-compose run --rm test ls -l /bin/readlink
Creating tmputpywvkia7_test_run ... done
-rwxr-xr-x 1 root root 39328 Feb 7 2022 /bin/readlink
Everything seems fine.
So where is the problem?
Finally, if they can serve some info
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
$ docker --version
Docker version 20.10.25, build 20.10.25-0ubuntu1~22.04.1
$ bash --version | head -n 1
GNU bash, versione 5.1.16(1)-release (x86_64-pc-linux-gnu)
$ docker-compose run --rm test bash --version | head -n 1
Creating tmputpywvkia7_test_run ... done
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-musl)