Closed 3ronco closed 6 months ago
As the oracle user is created during build there is no default .bashrc for oracle user to begin with.
In previous versions of the oracle/database image this was handled correctly.
The creation of the user at image buildtime is irrelevant for this. It is used as soon as you start a new container for any bash invocation, as this might be a tiny detail looking not very important, your change can issue problems for people not knowing that ~/.bashrc
in your image behaves different than in any other distro especially when you need to embed customized executables via PATH var or global settings via /etc/bashrc
eg. when you use scripts for database initialization in /docker-entrypoint-initdb.d/{startup,setup}
export ORACLE_SID=${ORACLE_SID^^}' > .bashrc
@3ronco what I meant was that the above cmd is what creates .bashrc as it was not existing before that so > or >> does not make a difference
@yunus-qureshi ok, when i run buildContainerImage.sh
the resulting image contains the file:
me@myMachine:~ $ docker run -ti --rm --entrypoint "" oracle/database:19.3.0-ee /bin/bash
[oracle@fa40941978bf ~]$ ls -la
total 20
drwx------ 1 oracle oinstall 104 Mar 25 17:16 .
drwxr-xr-x 1 root root 12 Mar 25 17:16 ..
-rw-r--r-- 1 oracle oinstall 18 Nov 23 2021 .bash_logout
-rw-r--r-- 1 oracle oinstall 193 Nov 23 2021 .bash_profile
-rw-r--r-- 1 oracle oinstall 300 Mar 25 17:21 .bashrc
-rw-r--r-- 1 oracle oinstall 172 Aug 9 2022 .kshrc
lrwxrwxrwx 1 root root 26 Mar 25 17:16 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@fa40941978bf ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
@3ronco i see, we'll check and get back on this. I am surprised that it even contains .kshrc as we don't install ksh.
I think there's a case for performing >>
vs >
should an image include a custom .bashrc
introduced via modifications in the build scripts.
@yunus-qureshi I believe that ksh
gets installed by oracle-database-preinstall-*
; ksh
is a long-standing prerequisite for Oracle databases:
# yum install -y oracle-database-preinstall-19c
...
Dependencies Resolved
========================================================================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================================================================
Installing:
oracle-database-preinstall-19c x86_64 1.0-3.el7 ol7_latest 27 k
Installing for dependencies:
...
ksh x86_64 20120801-144.0.1.el7_9 ol7_latest 882 k
...
---> Package ksh.x86_64 0:20120801-144.0.1.el7_9 will be installed
I see. Thank you @oraclesean
Thanks for your efforts :+1:
In docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0/Dockerfile the line:
RUN echo 'ORACLE_SID=${ORACLE_SID:-ORCLCDB}; export ORACLE_SID=${ORACLE_SID^^}' > .bashrc
replaces oracle user's bash environment completely. I guess
... >> .bashrc
was intended?