[opc@instance-20240128-1525 ~]$ sudo yum install
docker-engine docker-cli
[opc@instance-20240128-1525 ~]$ sudo systemctl enable --now
docker
[opc@instance-20240128-1525 ~]$ sudo docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version:
19.03.11-ol
Storage Driver:
overlay2
Backing Filesystem:
xfs
Supports d_type:
true
Native Overlay Diff:
false
Logging Driver:
json-file
Cgroup Driver:
cgroupfs
Plugins:
Volume: local
Network: bridge host
ipvlan macvlan null overlay
Log: awslogs fluentd
gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary:
docker-init
containerd version:
7eba5930496d9bbe375fdf71603e610ad737d2b2
runc version: 860f061
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version:
5.4.17-2136.322.6.2.el7uek.x86_64
Operating System:
Oracle Linux Server 7.9
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory:
6.487GiB
Name:
instance-20240128-1525
ID:
6OVG:2ZU5:3GU5:AJKF:JAKN:FJSU:SJ2Q:D7ZM:ZNKN:EJKS:6T3M:3GJ6
Docker Root Dir:
/var/lib/docker
Debug Mode: false
Registry:
https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled:
false
Registries:
[opc@instance-20240128-1525 ~]$ sudo su
[root@instance-20240128-1525 opc]# docker login
container-registry.oracle.com
Username: *********
Password:
WARNING! Your password will be stored unencrypted in
/root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@instance-20240128-1525 opc]# docker pull
container-registry.oracle.com/database/enterprise:latest
[root@instance-20240128-1525 opc]# docker ps
CONTAINER ID
IMAGE
COMMAND CREATED STATUS PORTS NAMES
e556dbeb3c1d
container-registry.oracle.com/database/enterprise:latest "/bin/sh -c 'exec $O…" 5 seconds ago Up 4 seconds (health: starting) 0.0.0.0:1521->1521/tcp oracle-db
Check the logs
[root@instance-20240128-1525 opc]# docker logs oracle-db
From the log, we can after few mins, we can see a message like below.
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
Now, go inside the docker container.
[root@instance-20240128-1525 opc]# docker ps -a
CONTAINER ID
IMAGE
COMMAND CREATED STATUS PORTS NAMES
e556dbeb3c1d
container-registry.oracle.com/database/enterprise:latest "/bin/sh -c 'exec $O…" 2 hours ago Up About an hour (healthy) 0.0.0.0:1521->1521/tcp oracle-db
[root@instance-20240128-1525 opc]# docker exec -it oracle-db
/bin/bash
bash-4.2$ whoami
oracle
bash-4.2$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Sun Jan 28
12:27:14 2024
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 -
Production
Version 21.3.0.0.0
SQL> show pdbs;
CON_ID
CON_NAME OPEN
MODE RESTRICTED
---------- ------------------------------ ----------
----------
2
PDB$SEED READ
ONLY NO
3
ORCLPDB1 READ WRITE
NO
bash-4.2$ df -kh
Filesystem
Size Used Avail Use% Mounted on
overlay
39G 19G 21G
48% /
tmpfs
64M 0 64M
0% /dev
tmpfs
3.3G 0 3.3G
0% /sys/fs/cgroup
shm
64M 0 64M
0% /dev/shm
/dev/sda3
39G 19G 21G
48% /etc/hosts
tmpfs
3.3G 0 3.3G
0% /proc/acpi
tmpfs
3.3G 0 3.3G
0% /proc/scsi
tmpfs
3.3G 0 3.3G
0% /sys/firmware
how to connect to the db using sqldeveloper
This completes the step by step instructions on how we can install Oracle DB inside a docker container and subsequently connect to the DB using sqldeveloper client. I hope, this post will help someone.
Till then, start learning cloud.