Drop these two files in the same directory on a host with Make and Docker installed.
Entrypoint specified as a missing script at the path.
Invalid interpreter specified with the shebang.
Script without execution bits set (eg: no chmod +x
was run).
Script specified a valid interpreter but with invalid exec'd executable (ie: ruby
).
[ec2-user@ip-172-31-33-108 test]$ make
-- Printing out environment info
date
Wed Sep 12 14:33:00 UTC 2018
curl http://169.254.169.254/latest/meta-data/ami-id
ami-093381d21a4fc38d1
sestatus
SELinux status: disabled
rpm -qi docker | grep Version
Version : 18.06.1ce
-- Building test container
docker build -t scriptcontainer .
Sending build context to Docker daemon 3.584kB
Step 1/2 : FROM busybox:latest
---> e1ddd7948a1c
Step 2/2 : RUN echo "#!/no/interpreter" >> /nointerp.sh && chmod +x /nointerp.sh && echo "#!/bin/env ruby" >> /missing-from-path.sh && cp /missing-from-path.sh /nochmod.sh && chmod +x /missing-from-path.sh
---> Using cache
---> da40a8e706a9
Successfully built da40a8e706a9
Successfully tagged scriptcontainer:latest
-- Testing script invocation: with /missing-script.sh
docker run --entrypoint /missing-script.sh --rm scriptcontainer
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/missing-script.sh\": stat /missing-script.sh: no such file or directory": unknown.
make: [test-missing-script] Error 127 (ignored)
-- Testing script invocation: with /nointerp.sh
docker run --entrypoint /nointerp.sh --rm scriptcontainer
standard_init_linux.go:190: exec user process caused "no such file or directory"
make: [test-nointerp] Error 1 (ignored)
-- Testing script invocation: with /nochmod.sh
docker run --entrypoint /nochmod.sh --rm scriptcontainer
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/nochmod.sh\": permission denied": unknown.
ERRO[0000] error waiting for container: context canceled
make: [test-nochmod] Error 126 (ignored)
-- Testing script invocation: with /missing-from-path.sh
docker run --entrypoint /missing-from-path.sh --rm scriptcontainer
env: can't execute 'ruby': No such file or directory
make: [test-missing-from-path] Error 127 (ignored)