Getting Started with Docker 3 – Installation of a Containerized Oracle Database Instance and SQL Developer

Resilient Software and PL/SQL – Resilient Oracle PL_SQL  > Exams of Oracle, Executing the PL/SQL Procedure, Oracle Certification Exam, Oracle Certifications, There Is a Better Way >  Getting Started with Docker 3 – Installation of a Containerized Oracle Database Instance and SQL Developer
0 Comments

Example 2-3. Checking the log for the container again

Prepare
 
for
db
operation
8
%
complete
Copying
database
files
31
%
complete
Creating
and
starting
Oracle
instance

32
%
complete

36
%
complete

40
%
complete

43
%
complete

46
%
complete
Completing
Database
Creation

When the container creation is complete, you should see log content similar to Example 2-4.

Example 2-4. Checking the log for the container one last time

ALTER
SYSTEM
SET
local_listener
=

SCOPE
=
BOTH
;
ALTER
PLUGGABLE
DATABASE
ORCLPDB1
SAVE
STATE
Completed
:
ALTER
PLUGGABLE
DATABASE
ORCLPDB1
SAVE
STATE

2022

12

30
T19
:
28
:
54.854962
+
00
:
00
XDB
 
initialized
.
2022

12

30
T19
:
37
:
53.816824
+
00
:
00

ORCLPDB1
(
3
):
Resize
 
operation
 
completed
 
for
 
file
# 10, old size 337920K,
new
size
348160
K

If the log looks like the text in Example 2-4, then your Oracle Database is installed and ready to use.

Note

This is just a short technical note about the command in Example 2-1. The docker run command first creates a writable container layer over the Oracle Database image and then starts it using the specified run command. You can read more about layers here.

Once the run operation from Example 2-1 is complete, run this command to list all containers:

docker
container
ls

a

If the container is present, you should see something like Table 2-2 where there is just a single Oracle Docker container.

Table 2-2. Listing the Docker containers CONTAINER IDIMAGECOMMANDCREATEDSTATUS
380195f59d0dcontainer-registry.oracle.com/database/enterprise:19.3.0.0“/bin/sh -c ‘exec $O…”2
months
ago
Up 40
minutes
(healthy)

Notice in Table 2-2 that the status includes the word healthy. You’ll be happy to hear that this rather complicated run command in Example 2-1 only has to be run once. Subsequent runs can be completed using the following command to start the container:

docker
 
start
 
<
container_id
>

You will, however, need to supply the container ID from this command output, as shown in Table 2-2.

At the end of your session, you can use the following command to stop the container:

docker
 
stop
 
<
container_id
>

It’s not mandatory, but it may avoid you getting some strange error messages when you shut down your machine.

As mentioned earlier, the value of <container_id> can be acquired from the leftmost column in Table 2-2. So, for illustration, the full command pair to start and stop the container on my system is as follows:

  • To start the container: docker start 380195f59d0d
  • To stop the container: docker stop 380195f59d0d

Handling these container ID numbers seems a bit difficult, doesn’t it? The following section describes a way to make this a little easier.

Tip

Manually typing the container ID strings soon becomes tedious. You can instead copy the ID value from Table 2-2 as follows:

Right-click the command prompt title bar.

In the pop-up menu, click Edit followed by Mark.

Use your mouse to select the ID string.

Press Enter to copy the ID.

Right-click to paste the value where it is required.

The last step might be to paste the ID into another command prompt.

After using it for a while, you’ll notice that the Docker CLI isn’t too chatty. It just provides the bare minimum of feedback to facilitate your required workflows. So, when you run the following command, it produces this rather pithy response, where the container ID is echoed to the screen:

C
:
\
Users
\
Stephen
>
docker
start
380195
f59d0d
380195
f59d0d

The paucity of information reflects the fact that we are using a CLI and not a more advanced user interface. Tools with a more sophisticated user interface tend to provide much more information, as you’ll see in “An Alternative to the Command-Line Use of Docker”.

Leave a Reply

Your email address will not be published. Required fields are marked *