0

I have a docker container that, at start up, executes a shell script (startService.sh), which uses the "source" linux keyword (which my docker container doesn't like).  I'm seeing the error message below when running my image:

    ./startService.sh: 6: ./startService.sh: source: not found

Why am I seeing this error? Can one not use the "source" linux command in a script in an image?

Dockerfile:

   

FROM openjdk:8

    

    VOLUME /opt/att/ajsc/config

    COPY startService.sh /startService.sh

    RUN chmod 777 /startService.sh

    ENTRYPOINT ./startService.sh

startService.sh

#!/bin/sh

    export AJSC_HOME=/opt/att/ajsc

    export AJSC_CONFIG_HOME=${AJSC_HOME}/config

    

    source /opt/att/ajsc/etc/config /run.source

1 Answer 1

3

source is a command present in bash, but not in sh. In sh, use single dot .. The single dot . works in bash, too.

Your script has shebang #!/bin/sh. Either replace source with ., or replace #!/bin/sh with #!/bin/bash.

(This issue has nothing to do with docker.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.