I am using node:12-alpine
with a NodeJS backend calling ShellJS spawn
command. It is supposed to run the shell script and I have verified and tested that it works locally. However, it is showing this error when it is running in the Docker container.
I have also verified that the script exists in the folder using docker exec.
Do I need to configure in alpine for this to work?
This is the command that ShellJS is calling: source execute.sh
Error: spawn /usr/src/app/scripts/execute.sh ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn /usr/src/app/scripts/execute.sh',
path: '/usr/src/app/scripts/execute.sh',
If you would like to use shell scripts in alpine you have to install a package called bash
. It happens because alpine does not have a bash.
Alpine comes with ash
as the default shell instead of bash.
Here is an example to install bash in you alpine image.
Dockerfile
FROM alpine:latest
RUN apk add --update \
nodejs \
nodejs-npm \
bash && rm -rf /var/cache/apk/*
# ...