I've created a docker image, and attempted to run it like this:
IMAGE=$(docker build --network=host -q .)
docker run \
--network=host \
--rm $IMAGE sh -c "cd bamboo && ./publish.sh"
The output is:
sh: ./publish.sh: not found
This variation of the command
IMAGE=$(docker build --network=host -q .)
docker run \
--network=host \
--rm $IMAGE sh -c "cd bamboo && ls -l"
shows:
-rwxr-xr-x 1 node node 646 Nov 25 01:40 publish.sh
Outside the container (whose content is copied into the container via the docker file), while in same parent folder as the above script, running
cd bamboo & ./publish.sh
works as expected. Any ideas what I can be doing wrong?
I found this similar question: Container command '/start.sh' not found or does not exist, entrypoint to container is shell script
and it mentioned line ending on Windows (where I am running Docker) can be problematic. I confirmed my line ending are LF rather than CRLF.
EDIT: The first few lines of the called script is this:
#!/bin/bash
set -ex
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
and my dockerfile looks like this:
FROM node:12.16.2-alpine3.11
WORKDIR /app
# node image creates node user for security purposes
RUN chown -R node:node /app
USER node
COPY --chown=node:node . .
RUN yarn install --no-progress --pure-lockfile
RUN yarn build