Reputation: 19332
I am running a docker-compose
test; part of my stack that will perform the actual tests is the following service
tester:
image: tutum/curl:latest
volumes:
- ./ci/wait-for-it.sh:/usr/local/bin/wait-for-it.sh
- ./webhooks:/app/webhooks
depends_on:
- sut
command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
The command fails as follows:
ERROR: for 0114c9206690_alerta-_tester_1 Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
ERROR: for tester Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
The file being mounted does exist:
▶ ls docker-compose.test.yaml
docker-compose.test.yaml
Workspace/systems-utils/ alerta_dev_infra ✗ 1d ⚑ ◒
▶ ls ./ci/wait-for-it.sh
./ci/wait-for-it.sh
What is more, when trying to bind mount a non-existent file, instead of getting a mount-related error, i get the same error as above
tester:
image: tutum/curl:latest
volumes:
- ./ci/foofile.sh:/usr/local/bin/wait-for-it.sh
- ./webhooks:/app/webhooks
depends_on:
- sut
command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
$ docker-compose -f docker-compose.test.yaml up -d
ERROR: for tester Cannot start service tester: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"wait-for-it.sh\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.
What am I missing?
edit: Regarding the PATH
issue mentioned, here it is:
▶ docker run -it tutum/curl:latest printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=1f3090676fa0
TERM=xterm
HOME=/
What is more, the tester
service configuration is the exact same as in this project which runs perfectly.
As for the permissions issue:
Workspace/systems-utils/alerta-workable alerta_dev_infra ✗ 1d ⚑ ◒ ⍉
▶ ls -al ./ci/wait-for-it.sh
-rwxr-xr-x 1 pkaramol staff 5.1K Sep 6 22:02 ./ci/wait-for-it.sh
Upvotes: 2
Views: 864
Reputation: 1138
Looks like it could not find "executable file in $PATH"
So let's try to set executable permissions on ./ci/wait-for-it.sh
file:
$ chmod +x ./ci/wait-for-it.sh
Upvotes: 0
Reputation: 5053
The error message is pretty self-explanatory - wait-for-it.sh
is not on $PATH.
You need either add /usr/local/bin
to $PATH or change command to
command: ["/usr/local/bin/wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "pytest /app/webhooks"]
See also accepted answer to this question for why /usr/local/bin
might not be in path.
Upvotes: 1