Why does my dockerfile keeps throwing the below error where i am simply doing a sqlplus command using the db service in the docker-compose so that it connects to the same container.
The same command works when on the container.
I’m not sure but using the CMD that way is usually not recommended. You can learn about the reasons here:
You should create a start script and run like this:
The content of the start script could be:
exec sqlplus sys/password123@db:1521/ORCLPDB1 as sysdba @/tmp/utPLSQL/source/install_headless.sql
Or I gues you would like to use environment variables instead of setting the password the way you tried in your quoted code.
Of course you don’t have to always create a start script, but it helps sometimes so you can have any shell you define in the first line if the command requires bash or anything else. And exec is important usually. In your case since the command runs and stops, it is not so important but doesn’t hurt.