I am using MAC book with apple M1 chip, and I am using [Colima][1] to run the oracle container over M1 chip.
I have a requirement to run integration test cases over the oracle container. And I am trying to create oracle container using service defined in docker-compose.yaml file.
I am able to start the container successfully but I am not able to login from the SQL Developer tool installed on my machine.
I am getting authentication error:
Status : Failure -Test failed: ORA-01017: invalid username/password; logon denied.
[![enter image description here][2]][2]
The surprising part in this problem is, if I explicitly bring up the container using following docker run
command then, the DB login works properly with the SQL Developer tool, but it fails while running the container using compose file and docker compose up
command.
Below the docker command which I am using to bring up the container and I am able to login to the DB using username "SYS" and password "secret".
docker run --name devdb -p 1521:1521 -p 5500:5500 -e ORACLE_PWD=secret container-registry.oracle.com/database/express:21.3.0-xe
And, below the docker-compose.yaml file which is causing database login problem.
version: '3'
services:
oracle:
image: container-registry.oracle.com/database/express:21.3.0-xe
hostname: oracle
container_name: oracle
ports:
- 1521:1521
- 5500:5500
environment:
- ORACLE_PWD:secret
volumes:
- ./scripts/startup:/opt/oracle/scripts/startup
Below are the oracle server start up logs, where you can see the database server started successfully without any errors:
[+] Running 1/1
⠿ Container oracle Created 0.1s
Attaching to oracle
oracle | Starting Oracle Net Listener.
oracle | Oracle Net Listener started.
oracle | Starting Oracle Database instance XE.
oracle | Oracle Database instance XE started.
oracle |
oracle | The Oracle base remains unchanged with value /opt/oracle
oracle | #########################
oracle | DATABASE IS READY TO USE!
oracle | #########################
oracle |
oracle | Executing user defined scripts
oracle | /opt/oracle/runUserScripts.sh: running /opt/oracle/scripts/startup/ddl.sql
oracle |
oracle | Table created.
oracle |
oracle |
oracle | 0 rows deleted.
oracle |
oracle |
oracle | 1 row created.
oracle |
oracle | DONE: Executing user defined scripts
oracle |
oracle | The following output is now a tail of the alert.log:
oracle | Starting background process CJQ0
oracle | 2023-04-03T19:29:19.672431+00:00
oracle | CJQ0 started with pid=63, OS id=424
oracle | Completed: ALTER DATABASE OPEN
oracle | 2023-04-03T19:29:21.170374+00:00
oracle | ===========================================================
oracle | Dumping current patch information
oracle | ===========================================================
oracle | No patches have been applied
oracle | ===========================================================
oracle | 2023-04-03T19:29:36.087762+00:00
oracle | System State dumped to trace file /opt/oracle/diag/rdbms/xe/XE/trace/XE_cjq0_424.trc
oracle | 2023-04-03T19:30:03.688697+00:00
oracle | XEPDB1(3):TABLE AUDSYS.AUD$UNIFIED: ADDED INTERVAL PARTITION SYS_P360 (3199) VALUES LESS THAN (TIMESTAMP' 2023-04-04 00:00:00')
I tried removing the hostname, containerName and custom start up script configuration, but it did not help. I also tried the default password "CHANGE_ON_INSTALL" with SYS username but it did not work.
What is causing the authentication failure?
Do I need to explicitly provide tnsnames.ora or any other configuration while using docker-compose commands?
As I was able to login to the database while running the container with docker run
command, without providing the SID name. So, I assumed, there is no need to provide SID name with docker-compose
as well.
But, that was the main root cause behind the login issue. I provided the SID name in docker-compose
file as mentioned below, and I am able to login the the database using username : SYS, password : secret and SID : XE.
Please refer below docker compose file for your reference.
oracle:
image: container-registry.oracle.com/database/express:21.3.0-xe
hostname: oracle
container_name: oracle
environment:
- ORACLE_SID=XE
- ORACLE_PWD=secret
ports:
- "1521:1521"
- "5500:5500"
volumes:
- ./scripts/startup:/opt/oracle/scripts/startup