Running up dockerized Oracle database with user automatically created

I am struggling with creating a user automatically in dockerized Oracle db 12c. I manage building up an instance of Oracle db, but I would also like to create a user there just after initialization is complete (it takes about 10 min to be up and running).

My Dockerfile:

FROM example/database:12c


ENV ORACLE_PWD="example123"




sqlplus SYS/example123 as SYSDBA <<EOF    <--- part that does not run at all
alter session set container=ORCLCPDB1;
create user EXUSER identified by example1234;
grant create session to EXUSER;

Docker commands:

docker image build -t oracle-db .
docker run --rm --name oracle-container -p 1521:1521 -p 5500:5500 -d oracle-db

After running those snippets the database comes up properly, I can log in there and so on (e.g create a user with exact the same commands manually). The only issue is that run only exec $ORACLE_BASE/$RUN_FILE and the leftover part where admin logs to the db and create a user is somehow omitted. I know exec command runs another shell in this case but when I remove it and run a standalone script nothing changes at all. I have tried many different approaches to automate the task of creating a user just after the db is up yet unsuccessfully. Do you have any suggestions?

Source: StackOverflow