Alexey Starinsky
Alexey Starinsky

Reputation: 4275

Installing oracle database in a docker container using Official Dockerfiles

I already have some kind of a success with installing oracle database 18.3 SE2 (but not EE) and 12.2.0.1 SE2 in docker container using Official Docker files on Ubuntu 18.04 because when I start the container I get this:

#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
2019 - 03 - 06T12 : 43 : 19.265419 + 00 : 00
ORCLPDB1(3) : Completed : CREATE SMALLFILE TABLESPACE "USERS" LOGGING  DATAFILE  '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
ORCLPDB1(3) : ALTER DATABASE DEFAULT TABLESPACE "USERS"
ORCLPDB1(3) : Completed : ALTER DATABASE DEFAULT TABLESPACE "USERS"
2019 - 03 - 06T12 : 43 : 20.130939 + 00 : 00
ALTER SYSTEM SET control_files = '/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE = SPFILE;
2019 - 03 - 06T12:43 : 20.246414 + 00 : 00
ALTER SYSTEM SET local_listener = '' SCOPE = BOTH;
ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Completed : ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE

but when I do (from the host)

telnet 172.17.0.1 1521

I get

Trying 172.17.0.1... telnet: Unable to connect to remote host: Connection refused

does this mean that Oracle instance is not started inside the container? And how to find what is wrong?

ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255

sudo docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS                 PORTS                NAMES
1d4d7b01ae88        oracle/database-se:12.2.0.1   "/bin/sh -c 'exec $O…"   2 hours ago         Up 2 hours (healthy)   1521/tcp, 5500/tcp   oracle12se

Dockerfiles: 18.3.0, 12.2.0.1

I published all the steps I did on my blog.

Upvotes: 0

Views: 1053

Answers (1)

Stefan R
Stefan R

Reputation: 755

The docker0 interface is not the address of your container, it's a bridge interface for all docker containers.

You can get the container ip if you run sudo docker inspect [container_id]. In the output you've given above, for example, the container id is 1d4d7b01ae88.

A more standard approach would be to bind the container port to a host port, using the -p argument when running docker run. This is also what's mentioned in the relevant README for your dockerfile.

E.g.:

$ sudo docker run -d -it --rm --name oracle18se oracle/database-se:18.3.0 \ 
  -p [host-port]:1521 -p [host-port]:5500

Of course if you do that, I'd recommend that your host is not exposed to the outside world or that the access to the relevant port is controlled.

Upvotes: 1

Related Questions