How to prevent the `#!/bin/bash: not found` error when calling a script from Dockerfile

Viewed 10853

i have the following Dockerfile:

FROM debian:stretch-backports

MAINTAINER c33s

ARG DEBIAN_FRONTEND=noninteractive
COPY provision-base.sh /root/provision-base.sh
RUN chmod +x /root/provision-base.sh && /root/provision-base.sh

why do i get the following error running it:

...snip...
/root/provision-base.sh: 1: /root/provision-base.sh: #!/bin/bash: not found
...snip...
  • the file exists RUN ls /root/provision-base.sh shows it
  • RUN which bash also shows that bash is installed
  • the script gets started and continues after the error
  • the build succeeds

build log on dockerhub:https://hub.docker.com/r/c33s/debian/builds/bd6g8cqr2rtys9a2gguehcw/ (snip of the build log also on pastebin https://pastebin.com/6x1UK53H)

2 Answers
Related