Docker-images: Problem with container run

Created on 2 Dec 2016  路  7Comments  路  Source: oracle/docker-images

Builded image from instruction with command: _buildDockerImage.sh -v 12.1.0.2 -s_, but on running getting:

docker run --name oracle -p 1521:1521 -p 5500:5500 -e ORACLE_SID=ORCLCDB -e ORACLE_PDB=ORCLPDB1 -v /home/docker/oracle_db:/opt/oracle/oradata oracle/database:12.1.0.2-se2
ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: gK/tc5IJL8A=

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 02-DEC-2016 14:54:05

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting /opt/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/162c4eeb2b0b/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 02-DEC-2016 14:54:05
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/162c4eeb2b0b/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB.log" for further details.
cat: /opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log: No such file or directory

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 2 14:54:16 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to an idle instance.

SQL> ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' scope=spfile
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> Disconnected
mkdir: cannot create directory '/opt/oracle/oradata/dbconfig': Permission denied
mv: cannot stat '/opt/oracle/product/12.1.0.2/dbhome_1/dbs/spfileORCLCDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/12.1.0.2/dbhome_1/dbs/orapwORCLCDB': No such file or directory
mv: cannot move '/opt/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora' to '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory
cp: cannot create regular file '/opt/oracle/oradata/dbconfig/ORCLCDB/': No such file or directory
ln: failed to create symbolic link '/opt/oracle/product/12.1.0.2/dbhome_1/network/admin/tnsnames.ora': File exists
cp: cannot stat '/opt/oracle/oradata/dbconfig/ORCLCDB/oratab': No such file or directory

#

DATABASE IS READY TO USE!

#

tail: cannot open '/opt/oracle/diag/rdbms///trace/alert*.log' for reading: No such file or directory
tail: no files remaining

database

Most helpful comment

Here's what I did to resolve this for XE 18.4.0.

When I saw the initial "Permission denied" error, I exec'd a root shell and noticed that the /opt/oracle/oradata directory inside the container was owned by root:root. I changed this to oracle:dba like so:

$ docker exec -it <my-container-name> bash
bash-4.2# ls -ld /opt/oracle/oradata
drwxr-xr-x. 2 root root 4096 Jan  9 15:08 /opt/oracle/oradata
bash-4.2# chown oracle:dba /opt/oracle/oradata
bash-4.2# ls -ld /opt/oracle/oradata
drwxr-xr-x. 2 oracle dba      4096 Jan  9 15:08 oradata
bash-4.2# exit

(In the container, user oracle is UID 54321 and group dba is GID 54322.)

So then on my host:

$ mkdir ~/.oracle_xe_oradata
$ chmod 775 ~/.oracle_xe_oradata
$ sudo chown 54321:54322 ~/.oracle_xe_oradata

Finally, I re-ran the container using "-v $HOME/.oracle_xe_oradata:/opt/oracle/oradata" in the docker run command. Problem solved:

#########################
DATABASE IS READY TO USE!
#########################

All 7 comments

The user inside the container does not have write permissions on /home/docker/oracle_db as indicated by mkdir: cannot create directory '/opt/oracle/oradata/dbconfig': Permission denied.

Please make sure that the directory is writable for the user/group (oracle/dba) inside the container. Setting the write permission for others should be sufficient chown -R o+w /home/docker/oracle_db.

Thanks a lot!

I am having same issue. pls elaborate how this is resolved?

Whatever location that you mount to the volume, make sure that user inside the Docker container has write access in that location. Remember, the only thing that counts in Linux is the UID. So just because you have a user oracle inside the container doesn't mean that it is the same user oracle outside the container. You have to make sure that the UIDs match or give the correct permissions.

For example, if you have a /home/data make sure that it's either owned by a user with UID 54321 or make sure that you give write permissions to others, for example.

The user inside the container does not have write permissions on /home/docker/oracle_db as indicated by mkdir: cannot create directory '/opt/oracle/oradata/dbconfig': Permission denied.

Please make sure that the directory is writable for the user/group (oracle/dba) inside the container. Setting the write permission for others should be sufficient chown -R o+w /home/docker/oracle_db.

you probably meant chmod -R o+w /home/docker/oracle_db.

I tried to fix issue in similar way but still getting permission error

Here's what I did to resolve this for XE 18.4.0.

When I saw the initial "Permission denied" error, I exec'd a root shell and noticed that the /opt/oracle/oradata directory inside the container was owned by root:root. I changed this to oracle:dba like so:

$ docker exec -it <my-container-name> bash
bash-4.2# ls -ld /opt/oracle/oradata
drwxr-xr-x. 2 root root 4096 Jan  9 15:08 /opt/oracle/oradata
bash-4.2# chown oracle:dba /opt/oracle/oradata
bash-4.2# ls -ld /opt/oracle/oradata
drwxr-xr-x. 2 oracle dba      4096 Jan  9 15:08 oradata
bash-4.2# exit

(In the container, user oracle is UID 54321 and group dba is GID 54322.)

So then on my host:

$ mkdir ~/.oracle_xe_oradata
$ chmod 775 ~/.oracle_xe_oradata
$ sudo chown 54321:54322 ~/.oracle_xe_oradata

Finally, I re-ran the container using "-v $HOME/.oracle_xe_oradata:/opt/oracle/oradata" in the docker run command. Problem solved:

#########################
DATABASE IS READY TO USE!
#########################
Was this page helpful?
0 / 5 - 0 ratings